android - how can i remove a particular item from recyclerview list -


i'm using retrofit parse json array server. want user customize json input in recyclerview tap few sec , remove option pop particular json object! in recyclerview , pass activity through intent , here intent activity incomplete . in advance

    public class mainactivity extends appcompatactivity {          private static final string tag = mainactivity.class.getsimplename();         private view vm;          @override         protected void oncreate(bundle savedinstancestate) {             super.oncreate(savedinstancestate);             setcontentview(r.layout.activity_main);              final recyclerview recyclerview = (recyclerview) findviewbyid(r.id.places_recycler_view);             recyclerview.setlayoutmanager(new linearlayoutmanager(this));              apiinterface apiservice =                     apiclient.getclient().create(apiinterface.class);             call<placeresponse> call = apiservice.getdd();             call.enqueue(new callback<placeresponse>() {                 @override                 public void onresponse(call<placeresponse> call, response<placeresponse> response) {                     int statuscode = response.code();                     list<place> places = response.body().getplaces();                     recyclerview.setadapter(new placeadapter(places, r.layout.list_item, getapplicationcontext()));                 }                  @override                 public void onfailure(call<placeresponse> call, throwable t) {                     log.e(tag, t.tostring());                 }             });     }     protected void  onnextbutton(view vm){             intent intent = new intent(this, csblow.class);     intent.putextra("places",list<place>tostring());       startactivity(intent);     } //////////////////////////////////////////////////////////////////////////// <?xml version="1.0" encoding="utf-8"?>  <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:id="@+id/place_layout"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:gravity="center_vertical"     android:minheight="72dp"     android:orientation="horizontal"     android:padding="16dp">      <linearlayout         android:layout_width="0dp"         android:layout_height="wrap_content"         android:layout_weight="1"         android:orientation="vertical">          <textview             android:id="@+id/city"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:layout_gravity="top"             android:paddingright="16dp"             android:textstyle="bold"              android:textsize="16sp" />           <textview             android:id="@+id/lat"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:paddingright="16dp"             />          <textview             android:id="@+id/lng"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:maxlines="3"             android:paddingright="16dp"             />         <textview             android:id="@+id/needle"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:maxlines="3"             android:paddingright="16dp"             />     </linearlayout>   </linearlayout> 

if want remove item recyclerview animation need:

1) remove item adapter.

2) call adapter.notifyitemremoved(int).


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -