java - Android ListView only shows one item at a time -
my program when user enteres information , clicks "submit" button, data stored in separate activity's list view.i have shared preferences incorporated data stored. problem 1 piece of information gets stored @ time. if enter new piece of data, previous 1 overwritten.
public class previouspractices extends activity { int minutes,hours; string description; string date; listview practicelist; arrayadapter<string> adapter; arraylist<string> listitems = new arraylist<string>(); protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.previous_practices_layout); practicelist=(listview)findviewbyid(r.id.practicelist); adapter = new arrayadapter<string>(this, android.r.layout.simple_list_item_1,listitems); practicelist.setadapter(adapter); getintents(); loadpreferences(); } public void getintents(){ if (getintent().getextras() == null) { } else { bundle extras = getintent().getextras(); hours = extras.getint("hours"); minutes = extras.getint("minutes"); description = extras.getstring("description"); date = extras.getstring("dateofpractice"); adapter.notifydatasetchanged(); savepreferences("lists", date); } } right i'm working date simplify things. i'm not sure issue is, , i'd appreciate help.
Comments
Post a Comment