scrollable tab (swipe) with API 8 - android

I am trying to use the code template provided by android in eclipse and I set my min SDK to API 8. I tried to choose the "blank activity with scrollable tab" for using the swipe feature but it wouldn't let me continue and complaining that this code template support version 11 and more.
However, I thought that's why the support library of version 4 is! To support Api 4 and above.
Am I missing the point here or is there something I need to do?
Thank you

Use the android.support.v7 compatibility libraries (which work together with the v4 libraries).
When you create the project in eclipse set the minimum API version to 11 but once the project is created, edit AndroidManifest.xml to set minSDKVersion to 8.
From time to time when building the project, eclipse may complain about min SDK version being required for certain things - in this case just Clean the project and it will build without problems.

I have gotten it to work using ActionBarSherlock and ViewTabPager. Look into those

Related

Android studio 3 forcing me to create project with API 26

I'm trying to create a project with min sdk 18 and target 21. When I initially create a project a select the minimum SDK as 18 however it gives me no option to target 21 and gives me 26 by default. It's giving me a number of features that aren't supported in 18/26 such as android:roundIcon in the manifest and some drawables that I'm having trouble removing without getting errors. I've tried setting the min and target sdk in the build.gradle and then rebuilding the project as well as 'Sync project with gradle files'
EDIT: After deleting the 'mitmap' directory it seemed to resolve the problem but I'm wondering if I should even be deleting this?
Some features are removed (deprecated) in newer API levels, and some features are added or replaced. Generally, you can set your minimum SDK to a low API for example to 15 but if you initially created the project with higher minimum, Android studio gets excited and tries to implement the new stuff, later when you change your mind and specify low API it complains "I thought you wanted the new stuff :(" says the studio.
So you will need to do some refactoring in that case to your code like you just did.
Same applies to existing projects that target minimum API of +21.
When you change it to lower minimum API level things will turn red and it will most likely ask you to do a lot of if/else checking to existing code for API level for some features that work on certain API levels.
I hope that helps.

Android support library wrong version

I have a problem while building my android project due to some missing android-support-library (i.e: android-support-v7.jar) so to fix it I had to add an Android Support Library from eclipse wizard. However I was surprised that my $android_sdk_home/extras/andoird/support/v7/appcompact/libs contains android-support-v4.jar and android-support-v7-appcompat.jar. Is that normal?
If I understood you correctly, you're wondering if having both v4 and v7 support libraries is normal. It is perfectly normal as they have different purposes. Basically they provide you with widgets and APIs to be used respectively in API levels 4 and 7 and beyond. They also provide different interfaces.
You can read about it here in more detail: https://developer.android.com/topic/libraries/support-library/features.html

Problems editing target in project properties

I have a library project whose target in project.properties is android-11. I wanted to create an app which uses that library, but compatible with android 4.1.2, so i edited also the library target with android-16.
But when i've done this change, the application gave me some problems and didn't work as before: for example in devices with software menu buttons, the buttons did not appear.
Can you tell me why? Thanks
first of all pls goto the SDK manager and check if you have SDK for Android 16 or above installed. If not please install it, if you have already installed then don't change anything in then project.properties, goto AndroidManifest.xml and make sure that "maxSdkVersion" is equal to above 16, if not it means that the library is depreciated and you cannnot use it for latest version. But generally most of the old libraries would support new SDK builds, so I suggest you to leave it as android-11 as it makes no harm
<uses-sdk
android:minSdkVersion="3"
android:maxSdkVersion="16"/>

how to use android-support-v7 ActionBar for version 2.2

I want to have actionbar in my Android Project using android.support.v7.appcompat; and use it in android 2.2 API Version 8.
I Installed Android support library from SDK Manager, and also added the android-support-v7-appcompat from /extras/android/Compatibility/v7/
but the current version of this project is 4.2 (the last version of SDK I have already downloaded). When I add this project as a reference to my project I get error (my resurce file (R) has error and couldn't use R.layout.main)
how can I solve my Problem and use support.v7 ActionBar?
if Change it to Android 4.2; I don't have problem
You are forcing us to have to guess what "it" is.
If "it" is your build target (e.g., Project > Properties > Android in Eclipse), please set that to something like 4.2. This does not control what versions of Android your app runs on. Set your android:minSdkVersion to be 8 (for Android 2.2), as that is what controls what versions of Android your app runs on. Lint will tell you when you are using things that are legal for your build target, but newer than your android:minSdkVersion, so you can make sure that you are using those things appropriately.

How to build my own Grid Layout in ANDROID so that it can work with the devices which are below API 14

I want to build a Calculator App, in which I want to format all the required buttons in such a way that, they all appears in a Grid form to me....
The one which I've made is only running on Android 4.0 & above devices...But I want that my calculator app should run on maximum Android devices(Android 2.2 & above) & which have a GridLayout in it..!
Please help me by suggesting me some code or anything else...
Thanx!
A backwards compatible implementation (for API level 7 and up) of GridLayout is also available as Android library project in the support library. After you've downloaded this add-on, you'll find an Android library project in your local sdk folder located at:
<sdk_folder>\extras\android\compatibility\v7\gridlayout
Set it up as dependency of the project you're working on. After that, you'll need to change the references throughout your project from the level 14 version to this compatibility one in order to support pre-ICS devices. Usage should be similar, if not identical.
See also:
GridLayout in Android 2.0?
Grid Layout support in android API 10

Categories

Resources