How to link a widget Button to interact with in app ListView - Android -
i new android programming , understand how can done make communicating button widget , in app variables. example:
i have widget button if pressed 10 times result in listview 10 entries when open application. data insert local time. here's i'm trying do:
df = new simpledateformat("yyyy.mm.dd g 'at' hh:mm:ss z"); date = df.format(calendar.getinstance().gettime()); adapter = new arrayadapter<string>(this, android.r.layout.simple_list_item_1, listitems); listview.setadapter(adapter); widgetbutton.setonclicklistener(new view.onclicklistener() { public void onclick(view v) { listitems.add(date); adapter.notifydatasetchanged(); } });
i know it's wrong can't immagine other way. help?
Comments
Post a Comment