1. AC Question's Avatar
    this class receives intent from one activity and passed the same intent to the other activity. but the next activity crashed when i press the button.

    public class Addition1 extends AppCompatActivity {
    private String name;
    private String Area;
    private String M_unit;
    public void movetosecond(View view)
    {

    Intent intent = new Intent(this, Addition2.class);
    Bundle extras = new Bundle();

    extras.putString("name",name);
    extras.putString("Area",Area);
    extras.putString("Measurement Unit",M_unit);
    // extras.putString("Crop planted",Crop_grown);
    intent.putExtras(extras);
    startActivity(intent);
    finish();
    }
    Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_addition1);
    //taking data from bundle of intent
    Intent intent = getIntent();
    Bundle extras = intent.getExtras();

    name= extras.getString("name");
    Area= extras.getString("Area");
    M_unit= extras.getString("Measurement Unit");
    // String Crop_grown=extras.getString("Crop planted");

    TextView tv1=(TextView) findViewById(R.id.textView16);
    tv1.setText(name);
    TextView tv2=(TextView) findViewById(R.id.textView17);
    tv2.setText(Area);
    TextView tv3=(TextView) findViewById(R.id.textView23);
    tv3.setText(M_unit);
    // TextView tv4=(TextView) findViewById(R.id.textView19);
    //tv1.setText(M_unit);

    }
    }
    01-15-2017 08:16 AM

Similar Threads

  1. Why does my Samsung Galaxy S6 reboot after static shock?
    By AC Question in forum Ask a Question
    Replies: 4
    Last Post: 01-15-2017, 10:15 PM
  2. Is this Verizon Samsung Galaxy S4 System Update Real?
    By AC Question in forum Ask a Question
    Replies: 6
    Last Post: 01-14-2017, 09:24 PM
  3. HOW do I locate the Clip Tray on my Cell Phone???
    By AC Question in forum Ask a Question
    Replies: 1
    Last Post: 01-14-2017, 08:31 AM
  4. How do I Jailbreak My LG G4?
    By AC Question in forum Ask a Question
    Replies: 1
    Last Post: 01-14-2017, 02:17 AM
  5. Why won't snapchat pics and videos save on my HTC 10?
    By tomdzz in forum Ask a Question
    Replies: 0
    Last Post: 01-14-2017, 02:02 AM
LINK TO POST COPIED TO CLIPBOARD