正在加载图片...
Passing Data between Activities Intent Activity 1 Activity 2 /Create an activity using the constructor Intent intent new Intent(Activity1.this,Activity2.class); //Create a bundle Bundle bundleData new Bundle(); /Create put string data in the bundle (key-value pair) bundleData.putstring("key_name","name"); The Bundle bundleData.putstring("key_age","age"); class provides a container for /Create put the bundle data in the Extra of Intent intent.putExtras(bundleData); storing data /Invoke the activity using the created intent startActivity(intent); 11Passing Data between Activities 11 Activity 1 Activity 2 Intent // Create an activity using the constructor Intent intent = new Intent(Activity1.this, Activity2.class); // Create a bundle Bundle bundleData = new Bundle(); // Create put string data in the bundle (key-value pair) bundleData.putString("key_name", "name"); bundleData.putString("key_age", "age"); // Create put the bundle data in the Extra of Intent intent.putExtras(bundleData); // Invoke the activity using the created intent startActivity(intent); The Bundle class provides a container for storing data
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有