listview - Deleting an entry from list and inserting into another one. Android -


if there 2 lists in same view, how can move entry in 1 list other on click. made listviews , made adapters both of them. 1 list pending connection , other approved connections. each entry in pending connections has accept , reject button. on rejecting entry should deleted. part. kept override function in adapter of pending list connection reject button. on accept have insert same entry accepted list. not able because adapters of both listviews different , dont know how access them activity.java file. can 1 please me? in advance.

<textview     android:id="@+id/pendingheading"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:text="pending connections"     android:textsize="25sp"     android:textstyle="bold"     android:padding="10dip" />  <listview     android:id="@+id/pendingconnectionslist"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:padding="20dip" > </listview>  <textview     android:id="@+id/approvedheading"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:text="approved connections"     android:textsize="25sp"     android:textstyle="bold"      android:padding="10dip"/> <listview     android:id="@+id/approvedconnectionslist"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:padding="20dip" /> 

keep reference of adapters in activity like:

private listadapter mfirstadapter; private listadapter msecondadapter; 

now in listadapter add method add or remove item list. don't forget call notifydatasetchanged() after adding or removing data.

now can listen click event on listadapter using onclicklistener() method. inside listener can call method created.

good luck!


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -