How to enable drawer in activity when using custom navigation drawer
I have problem when clicking on a drawer it will navigate to an activity.
if ( (listDataChild.get(listDataHeader.get(groupPosition)).get(childPosition).equals("Fuel"))) {
Intent intent = new Intent(MainActivity.this, Fuel_1.class);
startActivity(intent);
But when it go the activity , i dont see the drawer . I need to press back then it will see the drawer. How to enable the drawer in activity?
|
show 1 more comment
I have problem when clicking on a drawer it will navigate to an activity.
if ( (listDataChild.get(listDataHeader.get(groupPosition)).get(childPosition).equals("Fuel"))) {
Intent intent = new Intent(MainActivity.this, Fuel_1.class);
startActivity(intent);
But when it go the activity , i dont see the drawer . I need to press back then it will see the drawer. How to enable the drawer in activity?
Show a detailed code of how you are doing it.
– Cool Guy CG
Nov 13 '18 at 8:34
@CoolGuyCG basically i want to display navigation drawer in activity.
– Muhammad Zawawi
Nov 13 '18 at 9:20
But a lot can still go wrong, so post the code of how you are doing it, then we can see what might be wrong and what needs to be added.
– Cool Guy CG
Nov 13 '18 at 9:30
Navigation drawers are attached to activities. The problem you are facing is that when you move to this new activity, the navigation drawer is not attached to the new activity but the previous activity, that's why you are not seeing it in the new activity. You may want to use fragments or add the navigation drawer to the new activity
– sudo_kaizen
Nov 13 '18 at 10:19
@OrimDominic actually I already use fragment and it is working but unfortunately I have a problem with fragment then want to use activity. Can we simply extends the navigation drawer?Because when if we use interface ,i need to add all the method of navigation drawer in the activity and it make the code too long.
– Muhammad Zawawi
Nov 13 '18 at 10:22
|
show 1 more comment
I have problem when clicking on a drawer it will navigate to an activity.
if ( (listDataChild.get(listDataHeader.get(groupPosition)).get(childPosition).equals("Fuel"))) {
Intent intent = new Intent(MainActivity.this, Fuel_1.class);
startActivity(intent);
But when it go the activity , i dont see the drawer . I need to press back then it will see the drawer. How to enable the drawer in activity?
I have problem when clicking on a drawer it will navigate to an activity.
if ( (listDataChild.get(listDataHeader.get(groupPosition)).get(childPosition).equals("Fuel"))) {
Intent intent = new Intent(MainActivity.this, Fuel_1.class);
startActivity(intent);
But when it go the activity , i dont see the drawer . I need to press back then it will see the drawer. How to enable the drawer in activity?
edited Nov 13 '18 at 9:19
Rahul Chandrabhan
1,70241222
1,70241222
asked Nov 13 '18 at 8:31
Muhammad ZawawiMuhammad Zawawi
127
127
Show a detailed code of how you are doing it.
– Cool Guy CG
Nov 13 '18 at 8:34
@CoolGuyCG basically i want to display navigation drawer in activity.
– Muhammad Zawawi
Nov 13 '18 at 9:20
But a lot can still go wrong, so post the code of how you are doing it, then we can see what might be wrong and what needs to be added.
– Cool Guy CG
Nov 13 '18 at 9:30
Navigation drawers are attached to activities. The problem you are facing is that when you move to this new activity, the navigation drawer is not attached to the new activity but the previous activity, that's why you are not seeing it in the new activity. You may want to use fragments or add the navigation drawer to the new activity
– sudo_kaizen
Nov 13 '18 at 10:19
@OrimDominic actually I already use fragment and it is working but unfortunately I have a problem with fragment then want to use activity. Can we simply extends the navigation drawer?Because when if we use interface ,i need to add all the method of navigation drawer in the activity and it make the code too long.
– Muhammad Zawawi
Nov 13 '18 at 10:22
|
show 1 more comment
Show a detailed code of how you are doing it.
– Cool Guy CG
Nov 13 '18 at 8:34
@CoolGuyCG basically i want to display navigation drawer in activity.
– Muhammad Zawawi
Nov 13 '18 at 9:20
But a lot can still go wrong, so post the code of how you are doing it, then we can see what might be wrong and what needs to be added.
– Cool Guy CG
Nov 13 '18 at 9:30
Navigation drawers are attached to activities. The problem you are facing is that when you move to this new activity, the navigation drawer is not attached to the new activity but the previous activity, that's why you are not seeing it in the new activity. You may want to use fragments or add the navigation drawer to the new activity
– sudo_kaizen
Nov 13 '18 at 10:19
@OrimDominic actually I already use fragment and it is working but unfortunately I have a problem with fragment then want to use activity. Can we simply extends the navigation drawer?Because when if we use interface ,i need to add all the method of navigation drawer in the activity and it make the code too long.
– Muhammad Zawawi
Nov 13 '18 at 10:22
Show a detailed code of how you are doing it.
– Cool Guy CG
Nov 13 '18 at 8:34
Show a detailed code of how you are doing it.
– Cool Guy CG
Nov 13 '18 at 8:34
@CoolGuyCG basically i want to display navigation drawer in activity.
– Muhammad Zawawi
Nov 13 '18 at 9:20
@CoolGuyCG basically i want to display navigation drawer in activity.
– Muhammad Zawawi
Nov 13 '18 at 9:20
But a lot can still go wrong, so post the code of how you are doing it, then we can see what might be wrong and what needs to be added.
– Cool Guy CG
Nov 13 '18 at 9:30
But a lot can still go wrong, so post the code of how you are doing it, then we can see what might be wrong and what needs to be added.
– Cool Guy CG
Nov 13 '18 at 9:30
Navigation drawers are attached to activities. The problem you are facing is that when you move to this new activity, the navigation drawer is not attached to the new activity but the previous activity, that's why you are not seeing it in the new activity. You may want to use fragments or add the navigation drawer to the new activity
– sudo_kaizen
Nov 13 '18 at 10:19
Navigation drawers are attached to activities. The problem you are facing is that when you move to this new activity, the navigation drawer is not attached to the new activity but the previous activity, that's why you are not seeing it in the new activity. You may want to use fragments or add the navigation drawer to the new activity
– sudo_kaizen
Nov 13 '18 at 10:19
@OrimDominic actually I already use fragment and it is working but unfortunately I have a problem with fragment then want to use activity. Can we simply extends the navigation drawer?Because when if we use interface ,i need to add all the method of navigation drawer in the activity and it make the code too long.
– Muhammad Zawawi
Nov 13 '18 at 10:22
@OrimDominic actually I already use fragment and it is working but unfortunately I have a problem with fragment then want to use activity. Can we simply extends the navigation drawer?Because when if we use interface ,i need to add all the method of navigation drawer in the activity and it make the code too long.
– Muhammad Zawawi
Nov 13 '18 at 10:22
|
show 1 more comment
1 Answer
1
active
oldest
votes
I don't fully understand your statement. It is required that if you click on any object in your drawer to take you to an activity specified according to your code. But I guess you want to go to the activity while still displaying your navigation bar? or probably for you to go back to your drawer with a back button from your present activity?. If the latter is the case you can do that in your manifest. just edit your present activity in your manifest like this: <activity
android:name="com.example.myfirstapp.DisplayMessageActivity"
android:label="@string/title_activity_display_message"
android:parentActivityName="com.example.myfirstapp.MainActivity" >
name: this should be the name of your present activity.
label: title of your activity.
parentActivityName: this is your Main Activity. the place you want to go back to when you press the back icon.
I hope you understand this
this is what i want to do " t I guess you want to go to the activity while still displaying your navigation bar?"..is it possible?
– Muhammad Zawawi
Nov 13 '18 at 9:19
While not use fragment instead of activity to solve this problem once and for all
– taiwo sunday
Nov 13 '18 at 10:26
you can follow an example from here developer.android.com/training/implementing-navigation/…
– taiwo sunday
Nov 13 '18 at 10:30
above answer by orindiminic is the best for my situation.Anyways thanks for your comment and help.
– Muhammad Zawawi
Nov 13 '18 at 16:04
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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%2f53276801%2fhow-to-enable-drawer-in-activity-when-using-custom-navigation-drawer%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I don't fully understand your statement. It is required that if you click on any object in your drawer to take you to an activity specified according to your code. But I guess you want to go to the activity while still displaying your navigation bar? or probably for you to go back to your drawer with a back button from your present activity?. If the latter is the case you can do that in your manifest. just edit your present activity in your manifest like this: <activity
android:name="com.example.myfirstapp.DisplayMessageActivity"
android:label="@string/title_activity_display_message"
android:parentActivityName="com.example.myfirstapp.MainActivity" >
name: this should be the name of your present activity.
label: title of your activity.
parentActivityName: this is your Main Activity. the place you want to go back to when you press the back icon.
I hope you understand this
this is what i want to do " t I guess you want to go to the activity while still displaying your navigation bar?"..is it possible?
– Muhammad Zawawi
Nov 13 '18 at 9:19
While not use fragment instead of activity to solve this problem once and for all
– taiwo sunday
Nov 13 '18 at 10:26
you can follow an example from here developer.android.com/training/implementing-navigation/…
– taiwo sunday
Nov 13 '18 at 10:30
above answer by orindiminic is the best for my situation.Anyways thanks for your comment and help.
– Muhammad Zawawi
Nov 13 '18 at 16:04
add a comment |
I don't fully understand your statement. It is required that if you click on any object in your drawer to take you to an activity specified according to your code. But I guess you want to go to the activity while still displaying your navigation bar? or probably for you to go back to your drawer with a back button from your present activity?. If the latter is the case you can do that in your manifest. just edit your present activity in your manifest like this: <activity
android:name="com.example.myfirstapp.DisplayMessageActivity"
android:label="@string/title_activity_display_message"
android:parentActivityName="com.example.myfirstapp.MainActivity" >
name: this should be the name of your present activity.
label: title of your activity.
parentActivityName: this is your Main Activity. the place you want to go back to when you press the back icon.
I hope you understand this
this is what i want to do " t I guess you want to go to the activity while still displaying your navigation bar?"..is it possible?
– Muhammad Zawawi
Nov 13 '18 at 9:19
While not use fragment instead of activity to solve this problem once and for all
– taiwo sunday
Nov 13 '18 at 10:26
you can follow an example from here developer.android.com/training/implementing-navigation/…
– taiwo sunday
Nov 13 '18 at 10:30
above answer by orindiminic is the best for my situation.Anyways thanks for your comment and help.
– Muhammad Zawawi
Nov 13 '18 at 16:04
add a comment |
I don't fully understand your statement. It is required that if you click on any object in your drawer to take you to an activity specified according to your code. But I guess you want to go to the activity while still displaying your navigation bar? or probably for you to go back to your drawer with a back button from your present activity?. If the latter is the case you can do that in your manifest. just edit your present activity in your manifest like this: <activity
android:name="com.example.myfirstapp.DisplayMessageActivity"
android:label="@string/title_activity_display_message"
android:parentActivityName="com.example.myfirstapp.MainActivity" >
name: this should be the name of your present activity.
label: title of your activity.
parentActivityName: this is your Main Activity. the place you want to go back to when you press the back icon.
I hope you understand this
I don't fully understand your statement. It is required that if you click on any object in your drawer to take you to an activity specified according to your code. But I guess you want to go to the activity while still displaying your navigation bar? or probably for you to go back to your drawer with a back button from your present activity?. If the latter is the case you can do that in your manifest. just edit your present activity in your manifest like this: <activity
android:name="com.example.myfirstapp.DisplayMessageActivity"
android:label="@string/title_activity_display_message"
android:parentActivityName="com.example.myfirstapp.MainActivity" >
name: this should be the name of your present activity.
label: title of your activity.
parentActivityName: this is your Main Activity. the place you want to go back to when you press the back icon.
I hope you understand this
answered Nov 13 '18 at 8:54
taiwo sundaytaiwo sunday
134
134
this is what i want to do " t I guess you want to go to the activity while still displaying your navigation bar?"..is it possible?
– Muhammad Zawawi
Nov 13 '18 at 9:19
While not use fragment instead of activity to solve this problem once and for all
– taiwo sunday
Nov 13 '18 at 10:26
you can follow an example from here developer.android.com/training/implementing-navigation/…
– taiwo sunday
Nov 13 '18 at 10:30
above answer by orindiminic is the best for my situation.Anyways thanks for your comment and help.
– Muhammad Zawawi
Nov 13 '18 at 16:04
add a comment |
this is what i want to do " t I guess you want to go to the activity while still displaying your navigation bar?"..is it possible?
– Muhammad Zawawi
Nov 13 '18 at 9:19
While not use fragment instead of activity to solve this problem once and for all
– taiwo sunday
Nov 13 '18 at 10:26
you can follow an example from here developer.android.com/training/implementing-navigation/…
– taiwo sunday
Nov 13 '18 at 10:30
above answer by orindiminic is the best for my situation.Anyways thanks for your comment and help.
– Muhammad Zawawi
Nov 13 '18 at 16:04
this is what i want to do " t I guess you want to go to the activity while still displaying your navigation bar?"..is it possible?
– Muhammad Zawawi
Nov 13 '18 at 9:19
this is what i want to do " t I guess you want to go to the activity while still displaying your navigation bar?"..is it possible?
– Muhammad Zawawi
Nov 13 '18 at 9:19
While not use fragment instead of activity to solve this problem once and for all
– taiwo sunday
Nov 13 '18 at 10:26
While not use fragment instead of activity to solve this problem once and for all
– taiwo sunday
Nov 13 '18 at 10:26
you can follow an example from here developer.android.com/training/implementing-navigation/…
– taiwo sunday
Nov 13 '18 at 10:30
you can follow an example from here developer.android.com/training/implementing-navigation/…
– taiwo sunday
Nov 13 '18 at 10:30
above answer by orindiminic is the best for my situation.Anyways thanks for your comment and help.
– Muhammad Zawawi
Nov 13 '18 at 16:04
above answer by orindiminic is the best for my situation.Anyways thanks for your comment and help.
– Muhammad Zawawi
Nov 13 '18 at 16:04
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%2f53276801%2fhow-to-enable-drawer-in-activity-when-using-custom-navigation-drawer%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
Show a detailed code of how you are doing it.
– Cool Guy CG
Nov 13 '18 at 8:34
@CoolGuyCG basically i want to display navigation drawer in activity.
– Muhammad Zawawi
Nov 13 '18 at 9:20
But a lot can still go wrong, so post the code of how you are doing it, then we can see what might be wrong and what needs to be added.
– Cool Guy CG
Nov 13 '18 at 9:30
Navigation drawers are attached to activities. The problem you are facing is that when you move to this new activity, the navigation drawer is not attached to the new activity but the previous activity, that's why you are not seeing it in the new activity. You may want to use fragments or add the navigation drawer to the new activity
– sudo_kaizen
Nov 13 '18 at 10:19
@OrimDominic actually I already use fragment and it is working but unfortunately I have a problem with fragment then want to use activity. Can we simply extends the navigation drawer?Because when if we use interface ,i need to add all the method of navigation drawer in the activity and it make the code too long.
– Muhammad Zawawi
Nov 13 '18 at 10:22