如何在标签活动的不同标签中获得意图额外的捆绑值?

时间:2013-06-28 08:44:40

标签: android android-intent bundle

在我的应用程序中,列表视图中有一些值,并且单击列表项目从数据库获取值并使用数组列表中的intent传递它

ArrayList<String> s = new ArrayList<String>();
            s = mDbHelper.fetchDetails(appName);
            // s.add(app_formno);
            /*
             * for(int i =0; i<Data.size();i++){ s.add(Data.get(position));
             * System.out.println(Data.get(position)+"*****"+i); }
             */
            prefEditor.putBoolean("gotobundle", true);
            prefEditor.commit();

            startActivity(new Intent(ListViewDetails.this,
                    ApplicationManagement.class).putExtra("list", s));

我正在使用Tab小部件(TAB 1)中的e bundle获取数组列表。

protected void onResume() {
    super.onResume();
    settings = getSharedPreferences("LandTshare", MODE_PRIVATE);
    prefEditor = settings.edit();

    boolean bool = settings.getBoolean("gotobundle", false);
    if (bool == true) {
        Bundle b = getParent().getIntent().getExtras();
        // ArrayList<String> bundlevalue = new ArrayList<String>();
        bundlevalue = new ArrayList<String>();
        if (b != null) {
            bundlevalue = b.getStringArrayList("list");

此代码在选项卡1中打印相应的值,但是当我转到选项卡2时,包中的值为空,我的应用程序强制关闭.. 以下是TAB 2中的代码

protected void onResume() { 
    super.onResume();
    boolean bool = settings.getBoolean("gotobundle", false);
    if(bool == true){
            if (Applicant.bundlevalue.size() > 124 == true){
            for (int i = 125; i <= 146; i++)
                System.out.println(Applicant.bundlevalue.get(i));

            if (Applicant.bundlevalue.get(125).equalsIgnoreCase("Yes")) {
                rg_existin1.check(R.id.rYes);
            } else {
                rg_existin1.check(R.id.rNo);
            }

这里有什么问题?我似乎无法搞清楚! 请帮忙!

0 个答案:

没有答案
相关问题