Problem with getting id from bundle in android
up vote
0
down vote
favorite
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.
java android bundle
|
show 2 more comments
up vote
0
down vote
favorite
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.
java android bundle
Simply usegetIntent().getExtras().getInt(Constants.ID)
– Piyush
Nov 20 at 7:00
ok let me check
– S.H
Nov 20 at 7:01
1
You aren't sendingbundle
to theintent
.
– jack jay
Nov 20 at 7:05
have you put bundle to intent already ?
– Truong Giang Dam
Nov 20 at 7:06
where @TruongGiangDam ?
– S.H
Nov 20 at 7:10
|
show 2 more comments
up vote
0
down vote
favorite
up vote
0
down vote
favorite
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.
java android bundle
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.
java android bundle
java android bundle
edited Nov 20 at 7:03
Aniruddh Parihar
2,16111027
2,16111027
asked Nov 20 at 6:59
S.H
226
226
Simply usegetIntent().getExtras().getInt(Constants.ID)
– Piyush
Nov 20 at 7:00
ok let me check
– S.H
Nov 20 at 7:01
1
You aren't sendingbundle
to theintent
.
– jack jay
Nov 20 at 7:05
have you put bundle to intent already ?
– Truong Giang Dam
Nov 20 at 7:06
where @TruongGiangDam ?
– S.H
Nov 20 at 7:10
|
show 2 more comments
Simply usegetIntent().getExtras().getInt(Constants.ID)
– Piyush
Nov 20 at 7:00
ok let me check
– S.H
Nov 20 at 7:01
1
You aren't sendingbundle
to theintent
.
– jack jay
Nov 20 at 7:05
have you put bundle to intent already ?
– Truong Giang Dam
Nov 20 at 7:06
where @TruongGiangDam ?
– S.H
Nov 20 at 7:10
Simply use
getIntent().getExtras().getInt(Constants.ID)
– Piyush
Nov 20 at 7:00
Simply use
getIntent().getExtras().getInt(Constants.ID)
– Piyush
Nov 20 at 7:00
ok let me check
– S.H
Nov 20 at 7:01
ok let me check
– S.H
Nov 20 at 7:01
1
1
You aren't sending
bundle
to the intent
.– jack jay
Nov 20 at 7:05
You aren't sending
bundle
to the intent
.– jack jay
Nov 20 at 7:05
have you put bundle to intent already ?
– Truong Giang Dam
Nov 20 at 7:06
have you put bundle to intent already ?
– Truong Giang Dam
Nov 20 at 7:06
where @TruongGiangDam ?
– S.H
Nov 20 at 7:10
where @TruongGiangDam ?
– S.H
Nov 20 at 7:10
|
show 2 more comments
2 Answers
2
active
oldest
votes
up vote
0
down vote
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);
Constants.TITLE isString
notint
.
– Piyush
Nov 20 at 7:05
add a comment |
up vote
0
down vote
Try this way..
uid = getIntent().getExtras().getInt(Constants.ID);
when called below line it give bundle object.
Bundle bundle = getIntent().getExtras();
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
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);
Constants.TITLE isString
notint
.
– Piyush
Nov 20 at 7:05
add a comment |
up vote
0
down vote
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);
Constants.TITLE isString
notint
.
– Piyush
Nov 20 at 7:05
add a comment |
up vote
0
down vote
up vote
0
down vote
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);
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);
edited Nov 20 at 7:07
answered Nov 20 at 7:03
Nivedh
739515
739515
Constants.TITLE isString
notint
.
– Piyush
Nov 20 at 7:05
add a comment |
Constants.TITLE isString
notint
.
– Piyush
Nov 20 at 7:05
Constants.TITLE is
String
not int
.– Piyush
Nov 20 at 7:05
Constants.TITLE is
String
not int
.– Piyush
Nov 20 at 7:05
add a comment |
up vote
0
down vote
Try this way..
uid = getIntent().getExtras().getInt(Constants.ID);
when called below line it give bundle object.
Bundle bundle = getIntent().getExtras();
add a comment |
up vote
0
down vote
Try this way..
uid = getIntent().getExtras().getInt(Constants.ID);
when called below line it give bundle object.
Bundle bundle = getIntent().getExtras();
add a comment |
up vote
0
down vote
up vote
0
down vote
Try this way..
uid = getIntent().getExtras().getInt(Constants.ID);
when called below line it give bundle object.
Bundle bundle = getIntent().getExtras();
Try this way..
uid = getIntent().getExtras().getInt(Constants.ID);
when called below line it give bundle object.
Bundle bundle = getIntent().getExtras();
answered Nov 20 at 7:35
Android Team
7,34511033
7,34511033
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53387771%2fproblem-with-getting-id-from-bundle-in-android%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Simply use
getIntent().getExtras().getInt(Constants.ID)
– Piyush
Nov 20 at 7:00
ok let me check
– S.H
Nov 20 at 7:01
1
You aren't sending
bundle
to theintent
.– jack jay
Nov 20 at 7:05
have you put bundle to intent already ?
– Truong Giang Dam
Nov 20 at 7:06
where @TruongGiangDam ?
– S.H
Nov 20 at 7:10