android - Pass stringbuilder from one activity to the other -


i trying pass listview checkboxes of city names items 1 activity other. retrieving checked cities in stringbuilder. problem lies when try transfer stringbuilder object 1 activity other. wud appreciated..

the java file:

public class tailoredtwoactivity extends activity implements onitemclicklistener, onclicklistener{      stringbuilder builder;     button btn1;     listview mlistview;     string[] array = new string[] {"ham", "turkey", "bread"};      @override     public void oncreate(bundle savedinstancestate)      {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_tailoredtwo);          arrayadapter<string> adapter = new arrayadapter<string>(this, android.r.layout.simple_list_item_checked, array);          mlistview = (listview) findviewbyid(r.id.listviewcity);         mlistview.setadapter(adapter);         mlistview.setchoicemode(listview.choice_mode_multiple);          button button = (button) findviewbyid(r.id.btn_tailortwo_submit);         button.setonclicklistener(this);     }      public void onclick(view view) {         sparsebooleanarray positions = mlistview.getcheckeditempositions();         builder = new stringbuilder();         for(int index = 0; index < array.length; index++) {             if(positions.get(index)==true)             {                 builder.append(array[index]);                 builder.append(" ");             }         }         intent i1 = new intent(this, tailoredthreeactivity.class);         i1.putextra(android.content.intent.extra_text, builder);         startactivity(i1);     }       @override     public void onitemclick(adapterview<?> arg0, view arg1, int arg2, long arg3) {         // todo auto-generated method stub      } } 

instead of passing whole stringbuilder, can pass string stringbuilder holds. in other activity retrieve string , create new stringbuilder with

stringbuilder stringbuilder = new stringbuilder(currentstring); 

Comments