options-menu

Android options menu icon won't display

眉间皱痕 提交于 2019-12-17 06:48:08
问题 I'm following a book on Android Development to get myself started writing my first real app. I got up to the point where I'm making an options menu for one of my activities. The menu shows up, but the corresponding icon of the menu item refuses to display. Here is the code for the menu: ReminderListActivity @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); MenuInflater mi = getMenuInflater(); mi.inflate(R.menu.list_menu, menu); return true; } res/menu

Creating Options menu in Android

白昼怎懂夜的黑 提交于 2019-12-12 13:50:20
问题 I am trying to create options menu in my Android program. I am using the following code to inflate options menu : @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); MenuInflater inflater=getMenuInflater(); inflater.inflate(R.menu.optionsmenu, menu); return true; } And my xml code is : ?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/Option1" android:title="Option1"/> <item

Android Overflow Menu Button is not visible on some phones

て烟熏妆下的殇ゞ 提交于 2019-12-12 06:35:29
问题 The app runs fine. On devices with hard options menu button the menu shows up, so i know it works. On some devices it shows the overflow button at the top-right. I my test case the device is Asus Zenphone 5 there is no hard button, i dont get a overflow button either. But when i run the showOptionsMenu() command from a button click it displays the options menu and all related events work no issues. Menu - Xml <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android

How to programatically change an item in the options menu?

≡放荡痞女 提交于 2019-12-11 06:29:25
问题 When the user clicks on the Menu button I present a few menu items. One of them is a Sign Out button. I want to be able to change the text between "Sign In" and "Sign Out" depending on a boolean value I am tracking. How can I programmatically change the text in the menu? 回答1: You want to override the onPrepareOptionsMenu function in the Activity. There is a menu parameter passed, you can simply find the menuitem that you want to show/hide (or change the image and text) and return true.

Android: What could cause an Options Menu inflation error?

☆樱花仙子☆ 提交于 2019-12-11 05:32:55
问题 I am receiving an inflation error when pressing the Menu button and adding a menu item in the onCreateOptionsMenu method. I've included some of the error below. The code is as follows, and works if I try it on its own and not as part of my activity as a whole. I don't think it's feasible to paste in the whole of my activity here (I have no idea which bit could be causing this), so am wondering if anyone has experienced this before? public boolean onCreateOptionsMenu(Menu m) { Log.d(TAG, "Menu

openOptionsMenu() not working

牧云@^-^@ 提交于 2019-12-11 02:59:26
问题 Well, tried a lot of ways to solve this problem but nothing... I want to open the options menu via menu item. package com.example.tachles; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.ImageView; import android.widget.ShareActionProvider; public class MainActivity extends

how to get selected value from a option set crm 4 dynamics 2011 online

a 夏天 提交于 2019-12-10 15:58:27
问题 This is a question related to using javascript with crm 4 2011 online I created an optionset -status: open,closed and a onchange event handler that calls the function run with the context as parameter. In js i tried the following and more: function run(selectedItems) { var s = selectedItems[0]; } But i always get an undefined variable. How can get the selected value from a optionset? Thanks EDIT: i tried function run() { alert("hello"); var texter = Xrm.Page.getAttribute("new_state_request")

Android ActionBar Recreate Options Menu

家住魔仙堡 提交于 2019-12-10 01:56:49
问题 When using the ActionBar in Android, how do you refresh the options menu? I have tried hiding and showing the bar, along with getting a new instance of it with "getSupportActionBar()" I am trying to implement a Login/Logout button that will change dynamically based on the state of the user. Here is my onCreateOptionsMenu method @Override public boolean onCreateOptionsMenu(Menu menu) { if (loggedIn) menu.add(0, MENU2, 0, "Logout").setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); else menu.add

Android: adding text color,background and font size to optionsmenu

烈酒焚心 提交于 2019-12-08 07:33:33
问题 I tried a lot to add the font size , text color and background for my options menu but couldn't able to solve, how to do this for the following code?Help is always appreciated.....!, Thanks. @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); menu.add("Share In Heart Club!"); menu.add("Play"); menu.add("Check Your Heart Type?"); menu.add("Cancel"); // Return true so that the menu gets displayed. return true; } @Override public boolean

Launching activity from android options menu

半城伤御伤魂 提交于 2019-12-06 03:57:29
问题 I have looked through these forums to find a solution to this problem, and even though there appear to be solutions, none of them seem to be working for me. So here goes. I am a newbie to Android development. I have an app with an options menu. When I click on one to the options, I want it to launch a new activity - but I keep getting the error Intent cannot be resolved to a type in home.java on the line: Intent intent = new Intent(this, about.class); Below is all of my code that I believe is