android.app.DialogFragment not found - android

My android project supports a minimum api of 4.0. I should be able to use android.app.DialogFragment, but when I type in "DialogFragment" the only import available is from the support library. (I'm using AndroidStudio 0.8.14.)
If I try and add the import manually its not recognized as expected. I have the SDKs for 4.0 and above installed. Any ideas what I'm missing?

Did you change the API level minimum 11 in the Android_Manifest.xml?
You have to change it in this file.
In Android_Manifest.xml,
<uses-sdk android:minSdkVersion="**11**"
android:targetSdkVersion="integer" (above 11 or equal 11)
android:maxSdkVersion="integer" /> (above 11 or equal 11)
Could be possible problem.

Related

ADT project creating error

I would like to create a new project in ADT, but I can not do this, I always get similar messages to this:
This template requires a build target API version of at least 14, and
the current version is 10
I would like to use Android 2.3.3 to build.
Make sure you have updated the SDK manager upto the recent API level and you can set minSDK version to 10 and target SDKVersion as 14..Also set Theme as None because you are probably using a HoloTheme...
This template requires a build target API version of at least 14, and the current version is 10
Here it is clearly saying that your trying to use a template which requires minimum of API level 14 but you mentioned API level 10 as in your manifest file. So go to Android manifest file and change target SDK version to 14
like:
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="14" />

How to combine two projects made under different API level?

I m creating a customised music player with some additional features in it.... for that i copied one project whose API level is 10 and pasted it in my current working project whose API level is 19..... i m getting an error "Using 1.7 requires compiling with Android 4.4 (KitKat); currently using API 10"...... I don't know how to make two API level work in the same project ..... please help....... i tried cleaning my project and rebuilding it ..... but after that it shows R cannot be resolved to a variable
Try changing the api level on the project, in your project manifest you will find this line:
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="19" />
Change the targetSdkVersion to 19 to make it work with Android 4.4.

android.app.ActionBar class not being recognized

The problem i'm facing right now is Android Studio doesn't recognize import classes api level 11 and above. And in manifest the minsdk version i'm using is 14, this is fustrating. I'm trying to import android.app.ActionBar but i can't, i was going to use support library but there's no sense if i'm using api level 14.
Thanks.
I resolved it modyfing the build.gradle in the section {android,defaultConfig} :-)

How to support lowest possible API version?

I'm developing a Android library and I want to support as many API versions as possible. I have stumbled upon a problem with AsyncTask and found an answer here on SO. The proposed code to use is:
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) {
task.execute(params);
} else {
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params);
}
My question is, how do I include the proposed code AND support lowest possible API level? What API version should I reference? What should I write in the uses-sdk tag inte manifest?
Since the field THREAD_POOL_EXECUTOR in AsyncTask is only available from API level 11. Can this code be compiled to a lower level?
Thanks!
Assume that you line below exists in you manifest
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17"/>
This means that you are using features from API-17 but to ensure backwards compatibility your application may start on minimum API-8 (Froyo).
According to your example, using THREAD_POOL_EXECUTOR for API-17 or lower is OK. And running your code with Froyo device is OK too. Because THREAD_POOL_EXECUTOR field will not be used in this case.
In the manifest set android:minSdkVersion="minimumApiYouNeed", this is the lowest api you want to support, and the android:targetSdkVersion="maximumApi". This is the api that will be used to compile the code. This way you will be able to do things like what you wrote there, if you ever write something that is not supported by the minimum api, the editor will notify you, but it will work well if you do the checking it will work well
You will have to use API level 11 or higher unless you can find a library that works on an earlier API level that provides the THREAD_POOL_EXECUTOR implementation. Also, check to see if Google provides any backports or support libraries that would allow this to work before API 11.
This supports Android back to 2.1 (sdk version 7), but compiles the code against sdk version 17 (HoneyComb). You would have to add that tag to your manifest, of course.
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="17" />
Your project.properties should include this line:
# Project target.
target=Google Inc.:Google APIs:17

adding android:tragetSdkVersion= "14" in maifest for application developed for 2.3.3 version, is it a good idea?

I want to add android:tragetSdkVersion= "14" in my manifest but I'm consufed as initially I developed my application for 2.3.3 version. So I used TabActivity for that. But TabActivity is deprecated in 4.0 version and according to the documentation, including android:tragetSdkVersion= "14" means system will not impose any forward compatibility to the app. So I wonder if it is good idea to include android:tragetSdkVersion= "14" in my manifest.
If you want to make it working on sdk 14, why are you leaving TabActivity in your code?
Otherwise, don't make sdk14 your target, and better to prevent users with version 4.0 or higher to install your application
You should use the v4 support libraries if you target higher SDK versions and also provide a minSdk:
<uses-sdk android:minSdkVersion="integer"
android:targetSdkVersion="integer"
android:maxSdkVersion="integer" />
here is info about the support libraries
http://developer.android.com/tools/support-library/index.html

Categories

Resources