how to access this data in my activity? [closed]
public Bundle getCaseInfo(String param) {
Bundle b = new Bundle();
if(param.compareTo(Constants.CASE_INFO_SLECTED_TEETH) == 0) {
b.putStringArrayList(param,mCaseInfo.teeth);
} else if(param.compareTo(Constants.CASE_INFO_PATIENT_TYPE) == 0) {
b.putString(param, mCaseInfo.patient_type);
} else if(param.compareTo(Constants.CASE_INFO_PAIN_LEVEL) == 0) {
b.putString(param, mCaseInfo.pain);
} elseif(param.compareTo(Consta开发者_JS百科nts.CASE_INFO_TIME_LEVEL) == 0) {
b.putString(param,mCaseInfo.time);
} else if(param.compareTo(Constants.CASE_INFO_SWELLING_LEVEL) == 0) {
b.putString(param,mCaseInfo.swelling);
} else if(param.compareTo(Constants.CASE_INFO_SENSITIVITY) == 0) {
b.putString(param,mCaseInfo.sensitivity);
} else if(param.compareTo(Constants.CASE_INFO_ADVANCED_OPTION) == 0) {
b.putString(param,mCaseInfo.advancedoption);
} else if(param.compareTo(Constants.CASE_INFO_OTHER_SYMPTOMS) == 0) {
b.putString(param,mCaseInfo.othersymptoms);
} else if(param.compareTo(Constants.CASE_INFO_INSURANCE) == 0) {
b.putString(param,mCaseInfo.insurance);
} else if(param.compareTo(Constants.CASE_INFO_FULL_NAME) == 0) {
b.putString(param,mCaseInfo.fullname);
} else if(param.compareTo(Constants.CASE_INFO_TELEPHONE) == 0) {
b.putString(param,mCaseInfo.telephone);
} else if(param.compareTo(Constants.CASE_INFO_AGE) == 0) {
b.putString(param,mCaseInfo.age);
} else if(param.compareTo(Constants.CASE_INFO_GENDER) == 0) {
b.putString(param,mCaseInfo.gender);
}
return b;
}
How to get this details in my activity?
Do this :
Intent mIntent = new Intent(this, SecondActivityToBeCalled.class);
Bundle mBundle = getCaseInfo("your_Param");//call your function to get bundle values
mIntent.putExtras(mBundle);
startActivity(mIntent);//call second activity
Then, in the launched SecondActivityToBeCalled, you would read them via:
String value = getIntent().getExtras().getString(key)
精彩评论