2016-11-03 2 views
0

세 가지 활동이 있습니다. Activity에 하나 (탐색 메뉴), 나는 2를 시작하는 간단한 ClickListener 있습니다.하나의 활동에 여러 인 텐트 처리

Intent intent3 = new Intent(this, SettingsActivity.class); 
intent3.putExtra("from", "BaseActivity"); 
startActivity(intent3); 
finish(); 
break; 

Actvity에 나는 내가 Activity 두에 필요한 일부 데이터를 가지고있다. 나는 Activity 두를 시작하면 난 단지 세 번째에서 첫 Activity에서 Intent를 얻을 수 있지만 그래서

//send Data to Setting Activity 
Intent mIntent = new Intent(StartActivity.this, SettingsActivity.class); 
Bundle mBundle = new Bundle(); 
mBundle.putString("from", "SettingsActivity"); 
mBundle.putSerializable("spinnerHashTagItems", (Serializable) spinner_HashTagItem); 
mBundle.putSerializable("spinnerUserItem", (Serializable) spinner_UserItem); 
mBundle.putBoolean("isCheckedHashTag", isCheckedHashTag); 
mBundle.putBoolean("isCheckedHashTagUser", isCheckedHashTagUser); 
mBundle.putBoolean("isCheckedAllFromUser", isCheckedAllFromUser); 
mIntent.putExtras(mBundle); 

: 내가 갔다

//get loadet Settings from StartActivity 
Bundle bundle = getIntent().getExtras(); 
if (bundle != null) { 
    //do nothing 
} 

Bundle bundle1 = getIntent().getExtras(); 
spinner_HashTagItems.clear(); 
spinner_HashTagItems = (List<String>) bundle1.getSerializable("spinner_HashTagItem"); 
spinner_userItems.clear(); 
spinner_userItems = (List<String>) bundle1.getSerializable("spinner_userItem"); 
chbox_hashTag.setChecked(bundle1.getBoolean("chbox_hashTag")); 
chbox_hashTagUser.setChecked(bundle1.getBoolean("chbox_hashTagUser")); 
chbox_allFromUser.setChecked(bundle1.getBoolean("chbox_allFromUser")); 

그래서 나는이 같은 Bundle 내부의 데이터를 입력 디버거 물마루 ActivityBundleActivity 1에서 얻을. 어떻게하면 BundleActivity에서 3 개 구할 수 있습니까?

+0

이다'startActivity를 UR (mIntent)

StartActivity의 결과를 처리? –

+0

활동을 시작하고 싶지 않습니다. 데이터 만 필요합니다. 활동 1은 StartActivity이며, 시작시 설정을로드하고 데이터를 SettingActvity (활동 2)에 지정합니다. 앱 시작시 설정을 시작하고 싶지 않습니다. – dudi

+0

활동 1에서 활동 2를 통해 활동 3으로 보내려는 데이터가 있습니까? – vidulaJ

답변

0

SettingsActivityStartActivity에서 시작하려면 startActivityForResult (Intent intent, int requestCode)을 사용하십시오. ;`

@Override 
protected void onActivityResult(int requestCode, int resultCode, Intent data) { 
if (requestCode == REQUEST_CODE_YOU_USED_TO_START_SETTINGS_ACTIVITY) { 
    if (resultCode == RESULT_OK) { 
     //read the data from the Intent and prepare the Bundle for Activity Two 
    } 
} 
}