android-4.0-ice-cream-sandwich

Hide ICS back home task switcher buttons

假如想象 提交于 2019-11-26 06:30:50
问题 Just wondering how to hide the ICS back/home/etc software buttons programmatically. Just like the Youtube apps does when playing a video. I want to hide them while a video is playing, but bring them up if the user taps the screen. I can\'t seem to find it anywhere on the web, or in Google\'s documentation. 回答1: try to setup a Full screen window with flag SYSTEM_UI_FLAG_HIDE_NAVIGATION 回答2: pinxue is spot-on... you want SYSTEM_UI_FLAG_HIDE_NAVIGATION. Example: myView.setSystemUiVisibility(View

SearchView's OnCloseListener doesn't work

牧云@^-^@ 提交于 2019-11-26 06:29:38
问题 I\'m trying to add support for the SearchView in the Android 3.0+ ActionBar, but I can\'t get the OnCloseListener to work. Here\'s my code: @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu, menu); searchView = (SearchView) menu.findItem(R.id.search_textbox).getActionView(); searchView.setOnQueryTextListener(new OnQueryTextListener() { @Override public boolean onQueryTextChange(String newText) { searchLibrary(newText); return false; } @Override

Fragment onCreateView and onActivityCreated called twice

天涯浪子 提交于 2019-11-26 06:16:02
问题 I\'m developing an app using Android 4.0 ICS and fragments. Consider this modified example from the ICS 4.0.3 (API level 15) API\'s demo example app: public class FragmentTabs extends Activity { private static final String TAG = FragmentTabs.class.getSimpleName(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final ActionBar bar = getActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); bar.setDisplayOptions(0, ActionBar

how to turn speaker on/off programmatically in android 4.0

元气小坏坏 提交于 2019-11-26 05:28:42
问题 I play a file through media player and I want to give options like speaker on/off, play though headset, bluetooth ,etc. I tried the below code which works well for android 2.2 but I want something that can also work for 2.2 and 4.0 both. Can you help me to programmatically turn the speaker on/off and playing via headphones? AudioManager audioManager = (AudioManager)context.getSystemService(Context.AUDIO_SERVICE); if(isOn){ audioManager.setMode(AudioManager.MODE_IN_CALL); audioManager.setMode

INSTALL_FAILED_UPDATE_INCOMPATIBLE when I try to install compiled .apk on device

北战南征 提交于 2019-11-26 05:16:09
问题 I\'ve compiled Trebuchet launcher from CyanogenMod 9, and trying to install it with adb: $ adb install out/target/product/generic/system/app/Trebuchet.apk 3986 KB/s (7870141 bytes in 1.928s) pkg: /data/local/tmp/Trebuchet.apk Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE] I tried on Nexus S with CM9 and Galaxy Nexus with stock JB. Why I\'m getting this error? EDIT: In my case I\'ve tried to reinstall system package with package manager. That\'s not supported, so I\'ve got this error. Source of

Determine addAction click for Android notifications

二次信任 提交于 2019-11-26 05:15:37
问题 I\'m trying to use the new notifications interface. I\'ve added 3 buttons to the notifications, and I want to save something to my database once each of them is clicked. The notification itself works well and is shown when called, I just don\'t know how to capture each of the three different button clicks. I\'m using a BroadcastReceiver to catch the clicks, but I don\'t know how to tell which button was clicked. This is the code of AddAction (I\'ve excluded the rest of the notification, as

Check for navigation bar

馋奶兔 提交于 2019-11-26 04:40:05
问题 I am trying to check to see whether the android navigation bar is present on load so that I can adjust a layout accordingly, does anyone have any suggestions? This is the navigation bar I am trying to detect: P.S. All I have found so far are \'bad\' ways to try and remove the bar, which I dont want to do. 回答1: Took me some time but I've found a more reliable way than relying on hasPermanentMenuKey() which doesn't work for newer phones like the HTC One which have no menu key but do have home &

Difference between android-support-v7-appcompat and android-support-v4

烈酒焚心 提交于 2019-11-26 04:30:32
问题 I wanted to know the difference between android-support-v4.jar and android-support-v7-appcompat.jar . If I want to add appcompat Action Bar in my application do I need to add both android-support-v7-appcompat.jar and android-support-v4.jar or only android-support-v7-appcompat.jar . Also, does android-support-v13.jar has appcompat? 回答1: UPDATE There are many changes done into support library since this question was answered. Good thing is, it is very well documented also. So you must read

How can I force the Action Bar to be at the bottom in ICS?

泄露秘密 提交于 2019-11-26 04:21:01
问题 Ice Cream Sandwich (Android 4.0) adds the option of having the Action Bar at the bottom of the screen on phones, and that\'s something I\'d love to have in an application of mine. The docs mention uiOptions=\"splitActionBarWhenNarrow\" for when you want something, i.e. tabs, at the top and Action Bar shortcuts at the bottom. I\'ve tried adding the line in the application manifest, as described in the docs, but haven\'t got it working thus far. Here\'s an example: Also, I noticed that on my

getView returning null when fragment has been created from an activity

旧时模样 提交于 2019-11-26 03:58:23
问题 I have a working tablet application which I am now trying to make work on phones too. On a table there is two fragments on the screen a list fragment and a details fragment. When on a phone the list fragment appears and creates a new activity when a list item is pressed. This activity simply creates the fragment in the onCreate() method and commits it to the screen as follows. // Place an DeallDetailsFragment as our content pane DealDetailsFragment f = new DealDetailsFragment();