android 4.0, text on the action bar NEVER shows

I suspect that it was a conscious decision by the Android developers to never display a single menu item’s text and icon on a narrow action bar. But if you really want to do so, you can use android:actionLayout in your menu.xml file. The Android ActionBar documentation has a slightly better explanation. <?xml version=”1.0″ encoding=”utf-8″?> … Read more

getView returning null when fragment has been created from an activity

Move your method call to be executed during onCreateView, and use the view you are inflating for reference instead of getView(). See the fragment lifecycle for more information: https://developer.android.com/guide/components/fragments.html#Creating and the documentation of getView() that explains why it returns null before onCreateView(LayoutInflater, ViewGroup, Bundle) returns: getView() Get the root view for the fragment’s layout (the … Read more

Determine addAction click for Android notifications

It’s because you’re using FLAG_UPDATE_CURRENT with Intents that have the same action From the docs: if the described PendingIntent already exists, then keep it but its replace its extra data with what is in this new Intent. When you specify pendingIntentMaybe and pendingIntentNo, the system uses the PendingIntent created for pendingIntentYes, but it overwrites the … Read more

What are the default color values for the Holo theme on Android 4.0?

If you want the default colors of Android ICS, you just have to go to your Android SDK and look for this path: platforms\android-15\data\res\values\colors.xml. Here you go: <!– For holo theme –> <drawable name=”screen_background_holo_light”>#fff3f3f3</drawable> <drawable name=”screen_background_holo_dark”>#ff000000</drawable> <color name=”background_holo_dark”>#ff000000</color> <color name=”background_holo_light”>#fff3f3f3</color> <color name=”bright_foreground_holo_dark”>@android:color/background_holo_light</color> <color name=”bright_foreground_holo_light”>@android:color/background_holo_dark</color> <color name=”bright_foreground_disabled_holo_dark”>#ff4c4c4c</color> <color name=”bright_foreground_disabled_holo_light”>#ffb2b2b2</color> <color name=”bright_foreground_inverse_holo_dark”>@android:color/bright_foreground_holo_light</color> <color name=”bright_foreground_inverse_holo_light”>@android:color/bright_foreground_holo_dark</color> <color name=”dim_foreground_holo_dark”>#bebebe</color> <color … Read more

How to use Holo.Light theme, and fall back to ‘Light’ on pre-honeycomb devices?

You have to create a custom theme and save it in some directories to finally set this theme as the default one for the app First, in values add a themes.xml like this: <?xml version=”1.0″ encoding=”utf-8″?> <resources> <style name=”MyAppTheme” parent=”@android:style/Theme.Light.NoTitleBar”> <!– Any customizations for your app running on pre-3.0 devices here –> </style> </resources> Then, … Read more

Disable keyboard on EditText

Here is a website that will give you what you need As a summary, it provides links to InputMethodManager and View from Android Developers. It will reference to the getWindowToken inside of View and hideSoftInputFromWindow() for InputMethodManager A better answer is given in the link, hope this helps. here is an example to consume the … Read more

Fragment onCreateView and onActivityCreated called twice

I was scratching my head about this for a while too, and since Dave’s explanation is a little hard to understand I’ll post my (apparently working) code: private class TabListener<T extends Fragment> implements ActionBar.TabListener { private Fragment mFragment; private Activity mActivity; private final String mTag; private final Class<T> mClass; public TabListener(Activity activity, String tag, Class<T> … Read more

SearchView’s OnCloseListener doesn’t work

I also meet this problem, and I have no choice but give up “oncloselistener”. Instead, you can get your menuItem, then setOnActionExpandListener. Then override unimplents methods. @Override public boolean onMenuItemActionExpand(MenuItem item) { // TODO Auto-generated method stub Log.d(“*******”,”onMenuItemActionExpand”); return true; } @Override public boolean onMenuItemActionCollapse(MenuItem item) { //do what you want to when close the … Read more

Changing overflow icon in the action bar

You can with a style, but you have to add it to the main Theme declaration. <resources> <!– Base application theme. –> <style name=”Your.Theme” parent=”@android:style/Theme.Holo”> <!– Pointer to Overflow style ***MUST*** go here or it will not work –> <item name=”android:actionOverflowButtonStyle”>@style/OverFlow</item> </style> <!– Styles –> <style name=”OverFlow” parent=”@android:style/Widget.Holo.ActionButton.Overflow”> <item name=”android:src”>@drawable/ic_action_overflow</item> </style> </resources> You also can … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)