Is it possible to send data of multiple Edit texts to 2nd activity and show that data on single Text View? If possible than how?
Asked
Active
Viewed 55 times
-4
-
yes this is possible, you can use intent.putextra() for pass edit text value and second activity you will get this valu and send it. – user7176550 Nov 10 '17 at 11:45
-
3Possible duplicate of [How do I pass data between Activities in Android application?](https://stackoverflow.com/questions/2091465/how-do-i-pass-data-between-activities-in-android-application) – Munir Nov 10 '17 at 11:46
-
get and merge edit text data then send it to second activity through intent. – Gaurav Nov 10 '17 at 11:46
1 Answers
-2
You have to write this code where you call new activity
Intent intent = new Intent(this, yourActivity.class);
intent.putExtra("textOfEditText1",editText1.getText().toString());
intent.putExtra("textOfEditText2",editText2.getText().toString());
startActivity(intent);
And This code in your second activity's onCreate() method
Bundle b = getIntent().getExtras();
String s= b.get("textOfEditText1");
String s2=b.get("textOfEditText2");
textView.setText(s+s2);

Sanket Bhat
- 340
- 3
- 16
-
-
i am doing in same way but it shows null value of first string but shows the correct value of second string – Waqar Nov 10 '17 at 12:05
-