When I click on the presented button, the next activity started, but in view of the text it generated a null result on the following code Does.
I have an ArrayList, that should be passed for another activity and displayed as a group form individually or even.
Class A
want to store user information> ArrayList & LT; String & gt; FieldText = New Arrestist & lt; String & gt; (); Intent i1; Bundle bnd1; btSubmit.setOnClickListener (New OnClickListener () {@Override public void onClick (View arg0) {i1 = new Intent (WidgetDemo1Activity.this, Welcome.class); getDetails (); startActivityForResult (i1,0);}}); Public zero getDetails () {fieldText.add (0, etuname.getText (). ToString ()); FieldText.add (1, etpass.getText). ToString ()); //i1.putExtra ( "uname), Attinamkget text (). ToString ()); //i1.putExtra("pass", etpass.getText (). ToString ()); Bnd1 = new Bundle (); // ----- bundle of different add value to different fields ----- //bndlkputstring (free), Attinamkget text (for). ToString ()); //bnd1.putstring ( " passpass ", etpass.getText (). ToString ()); Bnd1.putStringArrayList (" data "field text); i1.putExtras (bnd1);} class B
TV1 = (TextView) findViewById (R.id.txtView); Tv1.setText ( "welcome" + recipient (). GetExtras (). GetStringArrayList ( "uname")); < / Pre>
The key is to look at the bundle A different are using. Using something like below
tv1.setText ( "Welcome" + getIntent () getExtras () getStringArrayList ( "data") ..) .
Comments
Post a Comment