How to pass bean class one activity to another activity on android

前端 未结 4 1935
情书的邮戳
情书的邮戳 2021-01-16 11:25

Hi this is my listview onClicklister.

when i click the list item , I pass the the arraylist which is getting from bean class one activity to another activity like

4条回答
  •  花落未央
    2021-01-16 11:39

    Make your RouteBean class implements Parcelable interface. Then you can pass your custom class objects as bundle in intent to other activity.

    You can then use-

    class RouteBean implements Parceable Then while calling intent.

    Bundle bundle = new Bundle();
    RouteBean yourObj = new RouteBean();
    bundle.putParcelable("bundlename", yourObj);
    

    And in next Activity you can use

    RouteBean yourObj bundle.getParcelable("bundlename");
    

    More info on Parceable http://developer.android.com/reference/android/os/Parcelable.html.

提交回复
热议问题