Intent.getStringExtra()对于使用Parcelable Object发送的任何String,返回Null

时间:2017-06-08 14:21:33

标签: android android-intent parcelable

每当我尝试获取“Hello”或具有该parcelable的任何其他类型时 我认为它为null,任何人都可以帮忙吗?

// intent from current activity to Next Activity
                                    Intent intent = new Intent(InstructorLessonsActivity.this, InstructorTopicActivity.class);
                                    //Putting extras to get them in the Next Activity
                                    Bundle args=new Bundle();
                                    args.putParcelable("lesson",test);
                                    args.putString("courseid",courseID);
                               //     intent.putExtra("lesson",test);
                                    // starting the Activity
                                    intent.putExtras(args);
                                    startActivity(intent);
                                }

我尝试使用Bundle,但它没有希望,就好像parcelable覆盖了意图附加内容并且发生了

这是Next Activity getIntent Part

  //Getting intent and checking if it's null
    Bundle intent = getIntent().getExtras();
    if(intent!=null) {
         Log.v("intent Extra :  ", ":------------" + intent.getParcelable("lesson"));
        Log.v("intent Extra :  ", ":------------" + intent.getString("courseid"));
    }

0 个答案:

没有答案