0

whenever i try to get the "Hello" or any other type with that parcelable i get it as null , can anyone help ?

// 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);
                                }

i tried using Bundle but it's hopeless , it's as if parcelable overrides the intent extras and takes place

Here is the 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"));
    }
  • and where and how you define this test? It might be null when you put it. – X3Btel Jun 08 '17 at 14:29
  • It's defined right above this snippet as i logged it and it got me an object of the same type and it was not null i am sending to the other activity @X3Btel – Hossam Eldeen Onsy Jun 08 '17 at 14:30
  • Is your parceble interface properly implemented? https://stackoverflow.com/questions/7181526/how-can-i-make-my-custom-objects-parcelable – X3Btel Jun 08 '17 at 14:33
  • this is the java class that implemented parcelable https://ideone.com/m6tKhW Sorry for the link rep still low so can't get it here @X3Btel note : i use parcelable android studio plugin – Hossam Eldeen Onsy Jun 08 '17 at 14:37
  • it is only the parcable null, or even the string courseid? or the whole bundle? – Fusselchen Jun 08 '17 at 14:44
  • @Fusselchen if i get just the parcelable object , it's received perfectly if i just sent any object , it's received perfectly but 2 objects and one of them is parcelable , the parcelable one is received while the other is null no matter what i do – Hossam Eldeen Onsy Jun 08 '17 at 16:38

0 Answers0