android-compatibility

Usage of ?android:attr/ in backwards compatible apps

为君一笑 提交于 2019-11-30 06:56:50
问题 I'm trying to make my ICS (API level 15) app compatible with Gingerbread (API level 10), and I'm getting InflateException Error inflating class <Unknown> for any layout XML that has an ?android:attr/ attribute. If I comment out these attributes I can compile and run the app, but then it, of course, looks aweful. I'd rather not duplicate all of the items from android.R.attr that I'm using, but at the moment I'm lost as to another way to do it. I'm using ActionBarSherlock to get the ActionBar

How to clean back stack on Android API 10 (Android 2.3.3)

落爺英雄遲暮 提交于 2019-11-29 14:45:38
I would like to know how can I clean all previous activities of the stack (except the new one), but I want that in Android API 10 (Android 2.3.3). Guided with this answer , I know it is not directly possible because the flag dedicated to do that exists since API 11. But I would like to know if this is possible maybe with some compatibility or if someone has any solution. Thanks in advance. On way to do this is to always start your activities using startActivityForResult() . In the case where you want to clean the activity stack have the current activity call setResult(RESULT_CANCELED) and then

onCreateContextMenu() for EditText doesn't work on real device

二次信任 提交于 2019-11-29 10:28:08
问题 Just tried to test my app on real device (HTC Desire Z with Android 2.2). And found that my context menus doesn't work at all on EditText s. Otherwise context menus works: in ListView , ImageView and so on. On emulator everything works fine... When I tap on EditText it shows something like zoom frame and then shows unusual (not standard Android alike) context menu which reads: "select text", "select all". It doesn't show my menus. Here are screenshots: Before tap During tap After tap (just

Usage of ?android:attr/ in backwards compatible apps

五迷三道 提交于 2019-11-28 23:28:05
I'm trying to make my ICS (API level 15) app compatible with Gingerbread (API level 10), and I'm getting InflateException Error inflating class <Unknown> for any layout XML that has an ?android:attr/ attribute. If I comment out these attributes I can compile and run the app, but then it, of course, looks aweful. I'd rather not duplicate all of the items from android.R.attr that I'm using, but at the moment I'm lost as to another way to do it. I'm using ActionBarSherlock to get the ActionBar working, and I don't seem to be using anything else that requires the support library (although I've

How to determine fragment restored from backstack

无人久伴 提交于 2019-11-28 16:29:44
Been searching for this issue for a while to no avail now: How to determine fragment is being restored from backstack? I'm using the compatibility library and a ListFragment inside a FragmentActivity. When an item inside ListFragment is selected, a new Fragment is started to replace the ListFragment. I noticed that when the FragmentActivity gets paused, the Fragment's onSaveInstanceState is called. But when the Fragment is put into the back stack via FragmentTransaction, onSaveInstanceState doesn't get called, then the lifecycle methods onCreateView and onActivityCreated gets called with null

Android Support Package / Compatibility Library - use v4 or v13?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-28 07:14:33
I've just read this description of the Android Support Package / Compatibility Library... http://developer.android.com/sdk/compatibility-library.html ... and it's left me a little confused! It says that the v13 library is a superset of v4 but I thought it was the other way around? Getting practical: If I want to use the compatibility library such that my app builds and works fine for phones running Android 2.2 (API 8) through to 4.0 (API 14) and beyond, will v4 suffice for me? To target API 8 (v2.2) you should use the v4 version. Large sections of the v13 will work, but if you use any of the

Optimizing Android manifest file for largest number of supported devices

我的梦境 提交于 2019-11-27 20:45:00
I am having issues getting my Manifest file to be compatible with a lot of the newer phones when I upload a new APK file and I don't understand why. I am testing it on a brand new HTC Evo V , but for whatever reason, that device won't show up in the compatibility list. I'm compiling against API 17 with a minimum support of API 10, so that should encompass a large majority of the phones. What I've tried: Removed all permissions; no change Tried making WIFI not required; no change Removed installLocation to see if it made a difference; no change Even tried adding small screen support to see if

Optimizing Android manifest file for largest number of supported devices

我们两清 提交于 2019-11-27 04:28:08
问题 I am having issues getting my Manifest file to be compatible with a lot of the newer phones when I upload a new APK file and I don't understand why. I am testing it on a brand new HTC Evo V, but for whatever reason, that device won't show up in the compatibility list. I'm compiling against API 17 with a minimum support of API 10, so that should encompass a large majority of the phones. What I've tried: Removed all permissions; no change Tried making WIFI not required; no change Removed

reusing fragments in a fragmentpageradapter

坚强是说给别人听的谎言 提交于 2019-11-26 23:41:22
I have a viewpager that pages through fragments. My FragmentPagerAdapter subclass creates a new fragment in the getItem method which seems wasteful. Is there a FragmentPagerAdapter equivalent to the convertView in the listAdapter that will enable me to reuse fragments that have already been created? My code is below. public class ProfilePagerAdapter extends FragmentPagerAdapter { ArrayList<Profile> mProfiles = new ArrayList<Profile>(); public ProfilePagerAdapter(FragmentManager fm) { super(fm); } /** * Adding a new profile object created a new page in the pager this adapter is set to. * @param

Using android vector Drawables on pre Lollipop crash

*爱你&永不变心* 提交于 2019-11-26 12:55:48
I'm using vector drawables in android prior to Lollipop and these are of some of my libraries and tool versions: Android Studio : 2.0 Android Gradle Plugin : 2.0.0 Build Tools : 23.0.2 Android Support Library : 23.3.0 I added this property in my app level Build.Gradle android { defaultConfig { vectorDrawables.useSupportLibrary = true } } It is also worth mentioning that I use an extra drawable such as LayerDrawable(layer_list) as stated in Android official Blog ( link here ) for setting drawables for vector drawables outside of app:srcCompat <level-list xmlns:android="http://schemas.android