xml - how to transfer more then one string from one activity to another in android -


i have transfer more 1 string 1 activity activity in android , know how transfer 1 string 1 string in android more 1 string can not found ways code here ,

 if (long_insert_row_index>0){                         //spinner spdepcmpname = (spinner) findviewbyid(r.id.spdepcmpname);                         // string strcmp= spdepcmpname.getselecteditem().tostring();                         //string strcmp=depositecmpname;             //startactivity(new intent(depositactivity.this, auditpointdetailsactivity.class).putextra("insert_row_index",""+long_insert_row_index).putextra("segment_name", spinner_segment.getselecteditem().tostring()).putextra("audit_type_name", spinner_audit_type.getselecteditem().tostring()).putextra("audit_type_id", audit_type_id).putextra("segment_id", segment_id));   ///please see commented section @ bottom                       startactivity(new intent(depositactivity.this, depositenextactivity.class)                                 .putextra("insert_row_index",""+long_insert_row_index)                                 .putextra("cmpname", depositecmpname));                     }else {                         toast.maketext(depositactivity.this,"error while inserting data.please re-enter data.",toast.length_long).show();                     }                 } 

now want send both string 1 activity , dont know how 1 .

you can use code in first activity :-

  arraylist<string> arr = new arraylist<string>();     arr.add(long_insert_row_index);     arr.add( depositecmpname);     intent intent = new intent(firstactivity.this,secondactivity.class);                 intent.putextra("array_list", arr);                 startactivity(intent); 

now in class can use code saying :-

bundle extras = getintent().getextras();  arraylist<string> arr = (arraylist<string>)extras.getstringarraylist("array_list");           toast.maketext(getapplicationcontext(),""+arr.size(),toast.length_long).show(); 

hope help


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -