android - to display items in a listview based on a parameter -


i displaying 3 details database in 1 row of listview after user clicks on list item details should made visible in activity in list view.i tried m getting blank activity open instead of list.. listviewdetails.java

    listview.setonitemclicklistener(new onitemclicklistener() {          public void onitemclick(adapterview<?> listview, view view,                  int position, long id) {                 // cursor, positioned corresponding row in result set                 cursor cursor = (cursor) listview.getitematposition(position);                  // state's capital row in database.                 int appno=cursor.getint(cursor.getcolumnindexorthrow("appln_no"));                   intent objintent=new intent(getapplicationcontext(),displaydetails.class);                 objintent.putextra("countrycode", countrycode);                 startactivity(objintent);                  }     }); 

here m passing appno parameter next intent details related appno displayed in displaydetails.java

 public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.listdisplay);         intent intentobj=getintent();         int appno=intentobj.getintextra("appln_no", 0);          waydatabase way=new waydatabase(getapplicationcontext());          arraylist<string> listvalues=way.getlistdetails(appno);          if(listvalues.size()!=0)         {             listview lv=getlistview();             listadapter adapter=new arrayadapter<string>(displaydetails.this, r.layout.view_animal_entry, r.id.animalname, listvalues);             lv.setadapter(adapter);          }  } 

but screen balnk.. whats issue??? please help! thanks!

shiv,

you have fetched values in variable "appno" set values variable "countrycode" instead of "appno".

in displaydetails.java, trying fetch the variable "appln_no" incorrect.

if @ code seems want pass appno value activity should keep this:

listviewdetails.java objintent.putextra("countrycode", appno);

displaydetails.java

int appno=intentobj.getintextra("appln_no", "countrycode");


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -