0

i am having problem in getting the id in second activity, i am passing id in bundle like below in first activity

Bundle bundle = new Bundle();
                bundle.putInt(Constants.ID, featured.getId());
                bundle.putString(Constants.TITLE, "Team");
                openAcitivty(getBundle("Questions" , (Serializable) featured.getAll().getQa()) , ProviderQAactivity.class );

but when i am getting the id in the second activity, it is showing me zero here

 uid = getIntent().getBundleExtra(Constants.DATA).getInt(Constants.ID);

please suggests something.

Aniruddh Parihar
  • 2,674
  • 2
  • 19
  • 34
S.H
  • 129
  • 12

2 Answers2

0

Try

getIntent().getExtras().getInt(Constants.ID)
getIntent().getExtras().getString(Constants.TITLE)

may solve your problem.

Also let us know whats inside below function. Are you passing the bundle correctly to next activity via intent.

  `openAcitivty(getBundle("Questions" , (Serializable) featured.getAll().getQa()) , ProviderQAactivity.class );`

It must contain some code as

intent.putExtras(bundle);
Nivedh
  • 981
  • 1
  • 7
  • 19
0

Try this way..

uid = getIntent().getExtras().getInt(Constants.ID);

when called below line it give bundle object.

Bundle bundle = getIntent().getExtras();
Mobile Team ADR-Flutter
  • 12,062
  • 2
  • 29
  • 49