Skip to main content

All Questions

Filter by
Sorted by
Tagged with
0 votes
1 answer
212 views

Android MenuProvider adding menu items out of order when resuming activity w/ fragments?

Has anyone seen this? Feels like a bug in the Android MenuProvider. Activity A has menu items 1 & 2. Fragment A in Activity A has menu items 3 & 4. Menu items are in order: 1,2,3,4 ...
kenyee's user avatar
  • 2,349
1 vote
0 answers
24 views

FragmentPagerAdapter keeps not visible fragment menu

I'm using menu provider to create option menu specific by fragment, fragments are managed by viewpager + FragmentPagerAdapter (requireActivity() as MenuHost).addMenuProvider( object : ...
Nininea's user avatar
  • 2,719
1 vote
1 answer
65 views

Android Toolbar menu SearchView id is not matching inside Fragment

I'm trying to implement searchview on my fragment toolbar. For me other menu item is working properly but using searchview id is not either clicked or listeners invoked to perform searching. I'm ...
Nikita K's user avatar
0 votes
2 answers
1k views

MenuProviders are not switched automatically inside a ViewPager

I have a ViewPager with 2 Fragments. Each Fragment holds a MenuProvider which is added as follows: @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { ...
Carlo Codega's user avatar
-2 votes
1 answer
141 views

Calling menu items from API

I am an Android Developer and I need that my menu item list, it's icons, it's text everything I can update by calling API I don't need to change my code again and again for that.
Shobhit Dhuria's user avatar
0 votes
0 answers
909 views

Android Toolbar - NavigationUI.setupWithNavController in fragment

I am trying to use the NavigationUI and toolbar's menu to navigate across fragments. I follow the guide in Google as below: https://developer.android.com/guide/navigation/navigation-ui?hl=en#...
Howard Lau's user avatar
0 votes
1 answer
2k views

Implement menu in fragment in Android studio

I want to implement menu in fragment class. The fragment works fine and there is not error but there is no menu shown in the fragment. I am implementing the class in the following way public class ...
M Baig's user avatar
  • 187
0 votes
0 answers
99 views

Navigation drawer crash after adding Fragment

Hi I have problem with Navigation drawer. I used the default layout with navigation drawer to learn how to add more. I create similar classes like this default. But these thre clases witch was at the ...
patrykk1797's user avatar
1 vote
1 answer
422 views

Problem with displaying top app and contextual action bar in fragment

Initially, I tried to make the context menu appear after a long press on the RecyclerView element of the first fragment. Then I decided to make it at least appear. My application consists of three ...
Кирилл Химов's user avatar
0 votes
1 answer
29 views

Replacing ViewPager With MenuItem Fragment

I have an Activity in which total 4 fragments are there . Out of 4 , 3 fragments are integrated as Tabs with Viewpager , the 4th one is in the Menu as favourite icon . I want to open Favourite ...
Adi's user avatar
  • 921
1 vote
1 answer
142 views

How to temporarily block the ability to click a menu item

I have a menu when I click on a specific element of which the activity opens, but the user can quickly click menu iten 2 times, which will lead to the opening of the activity 2 times. How can I block ...
Destroyer's user avatar
  • 795
0 votes
0 answers
423 views

NullPointerException on Fragment setMenuVisibility(boolean)

I have BottomNavigationViewwith 5 items. Using Viewpager and Adapter pattern to load the fragments into the container. The crash occurs when the app goes to background then killed by the system and I ...
Byte Brad's user avatar
  • 2,357
1 vote
1 answer
415 views

ids on onOptionsItemSelected doesn't match

When call the method on my parent Fragment class the id from menu is different but the title is the same. I change the title in the xml from it menu to confirm and item menu is from there. I've ...
Faqtt0's user avatar
  • 145
0 votes
1 answer
47 views

Toolbar overflow menu sometimes aligned to left side of screen

My app has multiple Fragments and a custom Toolbar, on the MainActivity. The toolbar is inflated on my 1st fragment but not the other fragments. This has worked fine for months. But very recently the ...
grolschie's user avatar
  • 2,163
0 votes
1 answer
17 views

Menu icons dropping off

I'm currently having an issue with the menu bar, it will work 75% of the time, but after a while it will start to drop off the Shown items and won't add them or any others back onto the visible items (...
Brandon's user avatar
  • 1,387
0 votes
1 answer
1k views

Replace BottomAppBar menu with new menu inside a fragment

I am using a bottom app bar with a Navigation Drawer. When I click on one item of the drawer, a new fragment is added on top of my Main activity. Inside this fragment I want to have a RecyclerView. ...
Rolando Azevedo's user avatar
0 votes
1 answer
184 views

Hide Menu item in a Fragment on button click Android

I have a fragment where I am displaying a Menu with 2 menu items. Currently the menu items are shown as the fragment is displayed. Now, I want to hide them once a certain action takes place eg. User ...
user3034944's user avatar
  • 1,741
1 vote
0 answers
60 views

Fragment Activity with Menu in Toolbar

I have a fragment activity with Custom Toolbar as seen below . <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content"&...
Yatin's user avatar
  • 3,120
1 vote
2 answers
7k views

Menu is not showing in fragment

My requirement is simple, I want to open list of menuItems in fragment. So I created menu XML inside menu and trying to inflate inside onCreateOptionsMenu method in Fragment but unfortunately ...
user avatar
-1 votes
1 answer
33 views

Android Fragment Menus

In an app activity, I have four different fragments. I have added menus to each fragment with @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {} function. But when I ...
Aniket's user avatar
  • 745
0 votes
1 answer
641 views

Menu not visible in Fragment

I have a fragment that contains menu I have tried calling setHasOptionsMenu(true); in both onCreate() as well as onCreateView() and set a toolbar as my Actionbar. I have gone through all the ...
Sneha Raj's user avatar
  • 118
0 votes
1 answer
301 views

Tabbed Activity and Menu in Toolbar

I have a Tabbed Activity with 3 different tabs with fragments. I have a Toolbar too and in this Toolbar i have 1 static menu object and 1 dynamic object. I put the static object (bluetooth connection)...
Dario's user avatar
  • 757
0 votes
1 answer
1k views

Horizontal sliding menu inside android fragment

I'm making an app for a restaurant in Android Studio. I have a MainActivity with a Navigation Drawer and I change between different Fragments so I can keep the Navigation Menu the same but switch ...
David Kyoda's user avatar
1 vote
2 answers
512 views

Fragment displays wrong menu items

For unknown reason sometime my fragment is showing menu items that belongs to a different fragment. I have a single activity with custom back stack to maintain the correct flow using: Map<...
Ilya Sosis's user avatar
6 votes
3 answers
12k views

How to set menu items in a fragment toolbar?

I have a fragment in my Activity and the fragment has its own toolbar. Like this: Image Here is the layout of the fragment: <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"...
Bishwajyoti Roy's user avatar
0 votes
2 answers
230 views

Start activity vs Fragment

I am working at this project and I don't know which way is better to accompish this in terms of optimization. I want to create something like that: And then when you click on Button 1 other buttons ...
Marcello's user avatar
2 votes
2 answers
439 views

Always display double time menu item at Fragment

I just want to set an menu at action bar. It works but in a wrong way. just like this: I searched the problem almost all the night, but did not find any answer. Here is my code for the ...
generalSoap's user avatar
0 votes
2 answers
423 views

menu not created when fragment is created but works on resume

I have a fragment which displays a mapview. I have to inflate a menu layout from the fragment and I have added setHasOptionsMenu(true) in the code so that menu bar can inflated from the fragment. ...
user avatar
0 votes
0 answers
94 views

Android - Fragment to Main Layout

Good afternoon, I was following a tutorial to create a drawer menu for Android. As programmed, came to me the need for when I go into a Fragment Class, wanted on the menu when you press on the Home, ...
Bruno Nogueira's user avatar
0 votes
1 answer
699 views

Android Tabs Menu. How to separate fragments

I want to develop a top sliding menu as the following. I have seen many tutorials, but everyone works with fragments that makes the same function. What should I use to work with fragments with their ...
Santiago Gil's user avatar
  • 1,302
1 vote
0 answers
181 views

search is not working inside viewpager fragment

Score Screen Detail page I have a Fragment inside view pager. I am implementing the search using menus inside that Fragment. The Search is working fine when I am on current fragment, but when I ...
Naveen's user avatar
  • 21
0 votes
1 answer
262 views

How can I add a checkbox in my menu item in my fragment v4?

I have a fragment extends android.support.v4.app.Fragment. And I need a checkbox in my menu, but I know I can't use getSupportActionBar(), so How another choice I have? Thanks a lot.
Patricia Tapia's user avatar
0 votes
1 answer
103 views

Why items in Android menu gets add after each swipe?

I wanted to move some of my items in toolbar from right to left, for this I have used android.support.v7.widget.ActionMenuView, but I have ran into trouble. My activity contains three fragments. Now ...
Mustansir's user avatar
  • 2,515
0 votes
1 answer
57 views

Adding a menu to an activity than a fragment

I have a MainActivity along with a fragment. I have a refresh menu option that will refresh the data (Using AsyncTask). Is there any difference in inflating the refresh menu option in the fragment ...
Ranjan Srinivas's user avatar
0 votes
1 answer
278 views

Custom Menu change option menu in different fragments?

Fragment with Custom menu : can I fragment change how to menu change ?Fragment B is equals like above with different inflate XML menu Menu work ImageView menuView onClick and fragment change change ...
rahul's user avatar
  • 13
1 vote
1 answer
1k views

SearchView Menu Item Not Overriding Custom AppCompatToolbar

I'm working to implement a SearchView on my Fragment's RecyclerView as shown here. When the user taps the search button I want the Menu Item for the SearchView to Override the toolbar and display the ...
Angel's user avatar
  • 321
1 vote
2 answers
1k views

Using onOptionsItemSelected(MenuItem item) to change view to a different Tab

I have an app that has 4 (0,1,2,3) Tabs and Fragments. My Actionbar has a menu item called "settings". When settings is clicked I want to navigate from the current Tab/Fragment to Fragment(3). In each ...
MarcusRey's user avatar
  • 383
0 votes
1 answer
472 views

Activity to Fragment transition with slide menu

I am trying to make an App on android. I have made the slide in menu bar like the one shown in the the example picture below. The blue bar.It is my main activity. Now what I want is that my every ...
AAA's user avatar
  • 41
2 votes
3 answers
1k views

Android: onCreateOptionsMenu is called but actionbar menu isn't updated in fragment

I am using drawerlayout in activity with several fragments. By clicking the navigation item, I switch the fragment this way: switch (index) { case 0: if (checkinFragment ==...
hanswim's user avatar
  • 1,242
0 votes
1 answer
38 views

android some times menu does not show up

I am using options menu in message fragment where I can add friends from menu. I can navigate to this fragment from activity or fragment. When I launch this message fragment, menu is working fine. ...
Akshay Pure's user avatar
0 votes
1 answer
278 views

Nested fragment still being visible when tab change

I have an activity with a tab view which have two fragments(A and B). Fragments A have a frameLayout with a nested fragment C. When changed C to D and then change to another tab item, the method "...
Mariano Abotta's user avatar
1 vote
2 answers
549 views

Android : Menu items can't be removed in the fragment

I need to remove the inflated menu after I return to Fragment 1 from Fragment 2 after some action. I clear the menu after I make the popBackStack, but nevertheless the menu item can't be deleted. ...
Rikki Tikki Tavi's user avatar
0 votes
1 answer
213 views

Using onMenuItemCLickListener from activity to call methods from multiple fragments

i wish you all a good day. First of all, sorry if i mispell frecuently because i din't know how to write on english, at least properly. But that's not a problem for all the response's that u can ...
Ces Hern's user avatar
0 votes
0 answers
55 views

How to permanently remove menu icons from a fragment?

I have few fragments where i don't want to populate the menu so what i'am doing is i'm clearning the menu in every fragments as menu.clear() in the oncreate() method i have this setHasOptionsMenu(...
silverFoxA's user avatar
  • 4,639
6 votes
3 answers
11k views

How to add a menu in a fragment?

When I use a fragment, I don't get the menu in the ActionBar. I don't know where is the problem with the code despite the implementation of the onCreateOptionsMenu() method. Here's the code that I am ...
HiddenDroid's user avatar
  • 1,450
0 votes
1 answer
333 views

Menu of sherlock ActionBar in Fragment not showing icon

Anyone could help my with the icon not showing issue in sherlock Actionbar. I want to show the menu like: icon title. However, I try many ways from the answers of the similar question, it still only ...
Amy's user avatar
  • 113
0 votes
0 answers
813 views

Using openOptionsMenu() in onOptionsItemSelected() in fragment

I've got settings button at the right of my actionbar. main.xml from rsc/menu: <item android:id="@+id/action_settings" android:icon="@drawable/settings" android:orderInCategory="1" ...
tadvas's user avatar
  • 171
5 votes
4 answers
6k views

menu not appearing in Fragment

I'm attempting to put a menu into a fragment in my app. However, the menu isn't appearing when I run it. My understanding of the steps involved in making a menu display in a fragment (and please ...
rurouniwallace's user avatar
7 votes
1 answer
5k views

How to make different menu options in different Fragment?

I want to have completely different menu options in different fragment.I followed this post.But my fragment menu is adding with the activity menu.But i don't want to have activity menus in some of my ...
Setu Kumar Basak's user avatar
0 votes
2 answers
466 views

Android - Settings menu of the main activity

I have a settings menu item that is generated in MainActivity. All the MainActivity's job is to contain fragments that actually do the job. Those fragments have their own action bar items and they ...
Amos's user avatar
  • 1,341