I am very new to Android.
I need to create a list view, where there's a list of items on the left, and clicking on an item opens up a dialog box like thing to show info about the item. Moreover, I want to be able to select these (or check?) items from the list of items, then click on a "Done" button within the same screen to go back to another activity that uses the three selected item. I've tried reading up on the ListView documentation but so far Android hasn't been so intuitive, which is why I'm really held up.
Here's my current code:
public class PlayerList extends ListActivity {
static final String[] PLAYERS = new String[] { "Messi", "Ronaldo", "Drogba", "Wesley"};
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// no more this
// setContentView(R.layout.list_fruit);
setListAdapter(new ArrayAdapter<String>(this, R.layout.list_view2,PLAYERS));
ListView listView = getListView();
listView.setTextFilterEnabled(true);
listView.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
// When clicked, show a toast with the TextView text
// edit this part to be able to show a new screen with info about the player
Toast.makeText(getApplicationContext(),
((TextView) view).getText(), Toast.LENGTH_SHORT).show();
}
});
}
Can you please advise me on how I can 1) create the detailed screen for each item upon a click, 2) be able to check/select items, 3)modify the current code to include 1 & 2.
Thanks!