sqlite - listview Onitemclick listener in Android -


i getting trouble on itemclick listener in android using sqlite ,i getting data sqlite data base , need pass same arraylist next activity using onitemclick listener.,but not working .

 contactlist.clear();             string query = "select  * messagetable  userid = '" + userid +"'";             system.out.println("queryinsert="+query);            cursor c1 = sqlhandler.selectquery(query);           if (c1 != null && c1.getcount() != 0) {            if (c1.movetofirst()) {            {              contactlistitems contactlistitems = new contactlistitems();               contactlistitems.setslno(c1.getstring(c1.getcolumnindex("id")));                          contactlistitems.setmessage(c1.getstring(c1.getcolumnindex("message")));               contactlist.add(contactlistitems);              } while (c1.movetonext());            }           }           c1.close();          } 

here arraylist arraylist<contactlistitems> contactlistwhere storing sqlite data , need pass data next on eachitem click ,could guide me .@thanks

try using one. can pass arraylist of class using serializable interface. check below code.

1) have implement serializable interface in contactlistitems class   public class contactlistitems implements serializable {  }  2) pass arraylist of contactlistitems via intent:  intent intent = new intent(yourcurrentactivity.this, destinationactivity.class); intent.putextra("contactlistdata", arraylistdata); //  here arraylistdata object of arraylist<contactlistitems> startactivity(intent);  3) intent of arraylist containing contactlistitems class:  arraylist<contactlistitems> contactlistdata;  bundle extras = getintent().getextras();    if (extras != null) {     contactlistdata = (arraylist<contactlistitems>) extras                     .getserializable("contactlistdata");     } 

hope you.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

java - Using an Integer ArrayList in Android -