Created
April 19, 2012 12:06
-
-
Save Ginny/2420546 to your computer and use it in GitHub Desktop.
Sharing a bundle between activities
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FirstActivity extends Activity { | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
ArrayList<String> events = new ArrayList<String>(); | |
events.add("Oslava narozenin Tomase"); | |
events.add("Koncert 2,5 promile"); | |
events.add("Grilovani na zahrade"); | |
Bundle params = new Bundle(); | |
params.putStringArrayList("param_events", events); | |
intent = new Intent().setClass(this, SecondActivity.class); | |
intent.putExtras(params); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SecondActivity extends Activity { | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
Bundle gottenParams = getIntent().getExtras(); | |
ArrayList<String> events = new ArrayList<String>(); | |
events = gottenParams.getStringArrayList("param_events"); | |
Bundle sendParams = new Bundle(); | |
params.putStringArrayList("param_events", events); | |
intent = new Intent().setClass(this, ThirdActivity.class); | |
intent.putExtras(sendParams); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ThirdActivity extends Activity { | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
Bundle gottenParams = getIntent().getExtras(); | |
ArrayList<String> events = new ArrayList<String>(); | |
events = gottenParams.getStringArrayList("param_events"); // a konecne dostanu ty udalosti | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment