am new in android development and am using xamarin.android. I am developing a application which contains two activities, Lets say A and B. Activity A contains two edittext and a button, Activity B contains a custom listview. Now what i want to do is passing the values from both edittext in Activity A to the custom listview in Activity B. I know how to create custom listview in the same Activity but dont know how to pass values to another Activity. Also i need to save the application state, that is the list that is created stays there if the user clicks on back navigation key or even if user stops the application.
-
Did you try google it? You need to post what did you try so far or some researches... Check: developer.xamarin.com/recipes/android/fundamentals/activity/…– Mariano ZorrillaNov 13, 2015 at 17:46
-
Please use the search - this is a commonly asked question– JasonNov 13, 2015 at 17:47
-
At least you have to try how to do. Then we can help you with your code.– CodeAloNov 13, 2015 at 17:49
Add a comment
|
1 Answer
On Activity A:
// Open B Activity
Intent intent = new Intent(getBaseContext(), B.class);
intent.putExtra("key1","value1");
intent.putExtra("key2","value2");
startActivity(intent);
On Activity B:
@Override
protected void onNewIntent(Intent intent) {
String s1,s2;
s1 = intent.getStringExtra("key1");
s2 = intent.getStringExtra("key2");
}