Text button text all caps for older api 8 - android

I am using android studio 2.1.2 and I need to design a app for api level 8 (android froyo). But I come up with 2 problem one is if I choose blank activity then is shows the rendering issue and second one is all the button text is appearing on capital letter. After some time on google I found that android:textAllCaps="false" but the issue is the property is not supported by the Api level 8 it requires minimum level 14. It will be very helpful if some one can able to solve this. I suppose that is is a matter of theme but most of the theme is not supported by lower api, I use different theme also but the problem remains, if any one knows a specific theme which don't force to make all the text to be caps.

try this in your Activity
mButton.setTransformationMethod(null);

Related

Android, knowing which api level to target

Using http://developer.android.com/about/dashboards/index.html I can see that going as far down as Gingerbread/API Level 10 all the way up will give me a range of 99.6%, but I am fairly new to Android development, I have never released an application and have some questions:
In my gradle script I have minSdkVersion as 10, targetSdkVersion as 21, is that right?
In my manifest file for all activities except my starting activity, I have the parentActivityName set. This gives a warning saying parentActivityName is only used from API Level 16, even though I use meta-data with parent activity defined in there. Am I missing something?
If I keep my manifest "as-is" and launch, will users running pre level 16 run into errors navigating back up the activity hierarchy?
Finally I tested my application in an emulator set to API Level 10 and there was no issues except for some minor UI stuff, however there was no way that I could see to press "Back" so I had to end the activity via Android Studio. How do you emulate going back in Gingerbread 2.3? My app does not have an action bar with left caret. Solely uses the phone's back button.
(1) Yes, you should always target the latest API. Source here.
(2) You don't need to specify your parentActivityName in the manifest. To get rid of the warning, you might as well remove the attribute. Source here.
(3) Not if you have set your minSdkVersion to 10, and implemented functionality that corresponds to these API levels. Also, when publishing to Google Market, devices that do not meet up with the minSdkVersion will not be able to download your app.
(4) Android phones always comes with a hardware back button. There is no need for the developer to implement this behavior, except when you want to modify it for your own needs. Source here.

Android API 20L preview and API 204.4W

here I face one problem after updating this both API level 20 (L and W). in my XML Graphical view the layout is not generated instead it is showing me this error:
Missing styles. Is the correct theme chosen for this layout?
Use the Theme combo box above the layout to choose a different layout, or fix the theme style references.
and also shows an error in res/values/styles.xml in this line
style name="AppBaseTheme" parent="Theme.AppCompat.Light
I use Eclipse juno.
To keep it simple, what you can do is select API 19 in the graphical layout and keep targetSdkVersion="19" and that should solve your problem. Basically the issue is with API20 bundles by google.
More insight about the issues with API 20L or 20W are already highlighted at below SO questions already...I've also responded with the google bug tracking link. Please have a look at those...
Many many issues, eclipse, android MediaPlayer, etc
latest 'ADT BUNDLE' open as JUNO eclipse for windows 7 64 bit
Hope this helps...

Android layout dont change after choosing higher SDK for Actionbar

I have made a programm based on SDK 7. Now I want to add an Actionbar to it. I changed the minSDK to 11 in the Manifest. Isn't that supposed to change the design of the layouts I already have?
Problem is, that I get returned "null" by getActionbar(). I read, that I have to activate the title bar in the OnCreate of the mainactivity. But that does'nt change anything, still "null".
I can see the titlebar, but on SDK 7 it's smaller than on SDK 11. Can't really describe my problem. I just want to use Actionbar on my old written App. But the Layout still looks like in the pic below (left).!
LayoutProblems
Hope someone can help me.
Thanks!
You should also replace the old android.jar with the new one from SDK 11 to get the new GUI. If you are using eclipse for development, just check different Project buid target under Project - Properties - Android.
If you want to use ActionBar in older devices you must use actionbar support library which is provided with the sdk.

Explain targetSdkLevel and how I should determine its correct value

Can you explain to me how I should determine the correct value for targetSdkLevel?
Let's say I want to build an app that works on all the versions from android 2.3.7 to 4.0.3, how should I set minSdkLevel and targetSdkLevel?
The former should match the API level of android 2.3.7 and the latter should match the API level of 4.0.3?
Then, when I develop my app, should I use only Methods/classes available in the oldest supported sdk level?
When I compile the app does it compile for 2.3.7 or 4.0.3?
I can not understand the purpose of targetSdkLevel, since the apk can not be compiled for the newer version specified in this tag, otherwise it could not work on versions down to the one specified by minSdkLevel... Why should I not set targetSdkLevel to the latest available level?
I've read also the official info about uses-sdk Manifest tag, but I still do not understand.. Can you help me clarifying this topic?
EDIT: thanks to all of you and excuse me for the duplicate question. I've read this Blog post and it really helped me. Great answers from all of you.
You should only use methods/classes available in the SDK specified by minSdkLevel, or otherwise wrap them with a proper check for the runtime API version.
Your application will be compiled with the SDK specified in the project itself, not by the one specified by either minSdkLevel nor targetSdkLevel.
You should set targetSdkLevel to the highest level API that you have tested the application with. This is because compatilibity behavior will be enabled/disabled for your application based on this value.
It clearly is explained here: http://developer.android.com/guide/topics/manifest/uses-sdk-element.html
minSdkVersion:
An integer designating the minimum API Level required for the
application to run. The Android system will prevent the user from
installing the application if the system's API Level is lower than the
value specified in this attribute. You should always declare this
attribute.
And for targetSdkVersion
An integer designating the API Level that the application targets. If
not set, the default value equals that given to minSdkVersion. This
attribute informs the system that you have tested against the target
version and the system should not enable any compatibility behaviors
to maintain your app's forward-compatibility with the target version.
The application is still able to run on older versions (down to
minSdkVersion).
What is that you don't understand here?
This is how you would set it:
<uses-sdk android:minSdkVersion="10"
android:targetSdkVersion="15"/>
You can read about the changes here, for API Level 14: http://developer.android.com/sdk/api_diff/14/changes.html
and here for API Level 4: http://developer.android.com/sdk/api_diff/4/changes.html
Build using the target, and then you can check and gracefully downgrade if the user is below the target. For example, if you are creating a location aware app, you might want to use PASSIVE_PROVIDER which is available starting with version 8. You could set the min version lower than 8 and check the android version. From there you could decide to use or not use PASSIVE_PROVIDER based on the version.
google suggests that you always use the latest version of the targetSdk , and also gives the lint tool to check for you that your classes and methods aren't too new for the minSdkVersion .
in case of a warning , you will need to think of how to handle it.
do note that as people has mentioned here , setting the targetSdk also means that it will change some aspects of the app .
one aspect is how the app treats the menu button : if you set the targetSdk to 11 or above , it means that you can't assume that there is a menu button , so you will have to deal with the action bar and put the options there in some way (or any other way, depending on your app design) .
if you set it to 10 or below , android will add this button (shown as 3 dots) on the screen for devices that don't have the menu button , like the htc one x or the galaxy nexus . do note that for some devices it looks ugly (takes a whole row for the htc one x , for example) .
so , in short , i would suggest setting the minSdk to the minimum that you can , in order to support as many people as possible , and the targetSdk to the maximum that you can , in order to enjoy all of the benefits that it can give you .

Button clicks in API level 3?

I've written a relatively simple app, and I've been testing it out on the various different API levels created through the SDK and AVD manager in Eclipse. It works great in all API levels except for level 3. I have a few spinners on the front page which work just fine, but my four buttons don't seem to be working. I've tried adding a breakpoint in one of the 'onClick' methods that I specified in my xml layout file, but the breakpoint never seems to get reached. I'm kind of at a loss here. Does anyone have any idea what could be going on here?
Level 3 does not support the onClick attribute in XML. Unfortunately, you'll have to wire up OnClickListeners in code.
... or drop support for 1.5. It's a small and shrinking part of the market.

Categories

Resources