android-4.0-ice-cream-sandwich

Reading all of today's events using CalendarContract - Android 4.0+

断了今生、忘了曾经 提交于 2019-11-29 01:52:34
I'm trying to use Android's new calendar API to read all of today's calendar events. I'm have trouble finding the right selection on the database query to return all of the events. It seems that all recurring and all day events are left out of the selection. What selection args would permit me to obtain all of today's events from the calendar api? Here is my current attempt: Cursor cur = null; String selection = "((" + CalendarContract.Events.DTSTART + " >= ?) AND (" + CalendarContract.Events.DTEND + " <= ?))"; Time t = new Time(); t.setToNow(); String dtStart = Long.toString(t.toMillis(false)

Unable to show keyboard automatically in the SearchView

空扰寡人 提交于 2019-11-29 01:16:40
The SearchView is focused by default, but when I try to show software keyboard - it doesn't happen: InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0); But when I click on the SearchView - it does. Why? Fixed! mSearchView.setOnQueryTextFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View view, boolean hasFocus) { if (hasFocus) { showInputMethod(view.findFocus()); } } }); And private void showInputMethod(View view) { InputMethodManager imm = (InputMethodManager)

Android Actionbar items as three dots

喜夏-厌秋 提交于 2019-11-29 00:22:50
问题 I have a menu for my main activity (res/menu/main_menu.xml) and I want only one item on the Actionbar and the rest shall be hidden under three dots menu. The problem is, I never see the three dots item on my actionbar. Why I can't see three dots item? How to force items to be hidden under it? Note: I use minSdkVersion="14" and I test in AVD. 回答1: <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk

toddler safe app on android

情到浓时终转凉″ 提交于 2019-11-28 22:03:46
I have an app, that should be toddler safe. Meaning that, it blocks any single key touch, yet handles long pressing for exiting the app. This is so that, the toddler will be safe from doing (too) nasty things while playing. Up to version 2.3.4, I succeeded in achieving this. However, now I have 2 problems: On honeycomb, I have the status bar notifications which can be pressed on. Also , I have the switch-windows key which can be pressed. The only thing I succeeded with it is to dim the status bar. On ice cream sandwich (using emulator, I still don't have a real device with this version), when

WebViewFragment webView is null after doing a FragmentTransaction

血红的双手。 提交于 2019-11-28 21:32:14
问题 I currently have my application set up with a ListFragment on the left and a DetailsFragment on the right (similar to the layout on the tablet below). On the details fragment (fragment next to the list) I have a goto deal button, which when pressed should replace the detailsFragment with a WebViewFragment . The problem I am having is that when trying to load a url in the webviewfragment the WebView is null. WebViewFragment webViewFragment = new WebViewFragment(); FragmentTransaction

EditText cursor is invisible in Android 4.0

梦想与她 提交于 2019-11-28 20:27:47
I have an EditText input in Android 4.0 and the Cursor is not showing inside it. What can make the cursor not appear in the input field? Pratik Butani AndroidDev Make android:cursorVisible="true" and If you have used android:textColor then set the android:textCursorDrawable attribute to @null . Happy coding ;) I had a similar problem but it was because the cursor is actually white and I had a white background. I needed to be able to change the cursor to black in code somehow and used this approach. I created a layout resource called textbox.axml which contained this <?xml version="1.0"

How to control ActionBar split programmatically?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-28 18:43:29
The android ActionBar may split into a top and bottom bars if activity's parameter " uiOptions " is set to " splitActionBarWhenNarrow ", note this parameter is only valid in ICS. Honeycomb has introduced a new approach to multi-select list items using action bar. When a item is under press & hold the list becomes into a multi-selection mode and the actionbar bar may be used to accomplish some actions. The actionbar setup is inherited from the list activity, i.e., if the activity has a split action bar the multi-selection will have too, and if the activity has only the top bar, so, the multi

WebView “flashing” with white background if hardware acceleration is enabled (Android 3.0+)

别来无恙 提交于 2019-11-28 17:24:08
问题 I have an issue with the WebView (Android 3.0+), which the WebView always displays a white background before display my black background ("flashing"). Here is my simple test code: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); WebView webView = new WebView(this); webView.setBackgroundColor(Color.BLACK); setContentView(webView); loadWebView(webView); webView.loadDataWithBaseURL("localhost://", "<html><head>" + "<style>body {background-color:

Exception when I run my application from Eclipse

本小妞迷上赌 提交于 2019-11-28 17:22:50
问题 I've been having this problem for almost 2 months now and can't figure it out. The problem is that if my application is running and I run (reinstall) my application from Eclipse, I get an error message indicating that my application has crashed 'Unfortunately, has stopped.'. I notice that it also occurs when I run it away from my PC/Eclipse, I think that it happens only after I don't run it for a while. It only occurs if the app is active in the 3rd activity ( BaseDiagramActivity ) and then I

Hide Status bar on Android Ice Cream Sandwich

為{幸葍}努か 提交于 2019-11-28 17:16:53
问题 I'm working in a launcher for Android ICS but I have a problem with tablets. I can't hide the status bar. I have try it in Android 2.3.X and it's ok. The problem appears only with Android 4.0. How can I hide it? 回答1: You cannot get rid of the system bar on tablets. You may be able to get rid of the navigation bar and status bar on phones. Please read the "Controls for system UI visibility" section of the Android 4.0 SDK release notes. 回答2: You can not get 100% true full screen in Android 4.0.