android - display particular image associated with the listview. -


I have a list of image names ... when I click on a specific image name in the list view, then you belong The picture should be displayed. how can I do this? My ListView like this:

ImageName1

ImageName2

ImageName3

.... ...

Now when I click on ImageNet 2: I will have to open an image related to ImageNet 2 in New_activity.

Should this be performed within this method:

  private void pathViewClick (ListView lv) {lv.setOnItemClickListener (New OnItemClickListener () {@Override public void onItemClick ( AdapterView or & lt;? & gt; parent, and see, int position, long id) {intent i = new intent (MainActivity.this, Activity2.class); i.putExtra ( "Map", "map1. Jpeg "); startActivity (i); end ();}}); }  

Try it:

  int position = Listview.getSelectedItemPosition (); I.putExtra ("map", "map" + status + "jpeg.");  

Edit 1

  int status = Listview.getSelectedItemPosition (); String pause = integer. Tosting (status); Log D. ("Status", position);  

This is going to be integer logging. I know what it says

Edit 2

  @Override Public Zero onItemClick (AdapterView & LT;? & Gt; Mother Father, see, int position, long id) {} ​​ 

onItemClick method above you position int ... then it

  @Override public Zero onItemClick (Try AdapterView & lt; Parents, View View, Integer Status, Long ID) {Intent I = New Intent (Main Activity., This, Activity 2. Category); I.putExtra ("map", "map" + status + "jpeg."); StartActivity (i); End(); }  

Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -