开发者

how to access this data in my activity? [closed]

开发者 https://www.devze.com 2023-04-12 07:50 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.
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)
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号