-2

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.

3

1 Answer 1

1

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");
}

Not the answer you're looking for? Browse other questions tagged or ask your own question.