Android Studio .code For Pass Data Between Two Edit Texts In Different Activities
I have made 3 activities first one is main and putted 2 button to pass to others pages through intent. I made intent between page 2 and page 3 for one Edit Text and it works good b
Solution 1:
It is because you are getting the string from activity 2 and when you go to activity 3 from the main activity it returns null, what you can do is to check if the bundle has empty string like this:
Bundle bundle= getIntent().getExtras();
if (bundle != null) {
editText.setText (bundle.getString ("string"));
}
else {
editText.setText ("Some string");
}
Solution 2:
I use bundle for fragments but for activities try this:
Intentintent= getIntent();
editText.setText(intent.getStringExtra("nameofstring"));
Post a Comment for "Android Studio .code For Pass Data Between Two Edit Texts In Different Activities"