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.
Related
I just started my first Android Studio project and I already come with a problem :)
I search on google for the answer but didn't find my problem.
So I need your help please ^^
I download the last version of Android Studio, create a project with an Empty Activity and I came up with this
As you can see my ConstraintLayout is really small and I just can't work with this.
I didn't touch anything on the project. Just to be sure I create 3 projects that have the same issue and redownload 4 time Android Studio.
On the virtual Devices, it looks correct throw: Screenshot
I put the XML code just in case it can help
xmlcode
Hope I was clear and sorry for my English ;)
EDIT: For some reason, the constraint layout fit correctly on the watch screen, but I don't want to create a watch app x) screenshot_watchview
Ok so I have finally find the problem ! I'm so happy right now :D
The problem was the AppTheme theme that I use, I switch it with the DeviceDefault theme. I don't know why this theme was causing problem but now it work and I can finally work on my first Android App !
If you are using the supportLibrary 28+ then this thing happened to me too.
and when I change the support lib version to the 27, it works.
Maybe this is a possible bug in the support library 28+.
Changing the AppTheme works like a charm if you want to stick with the support library 28+ But if you still don't want to so Try using the support library below 28.
could anyone please help me with this?
I opened an existing project and I get this error in the screenshot.
The problem is that you are using a style which require API 21. You are referencing a style called Widget.Material.ActionButton. So you need to put this reference in a v21 directory to use the CompatLibrary which I would recommend.
The real cause seems to be that you have a very low target SDK (like you wrote in the comments API 8). You should set it to the most newest one, it cannot break anything. So set the target SDK to API 21 or newer and it should work fine.
I know this may sound a trivial question, but I can't figure it out on my own. I've Googled and searched many many times. I know it may have a simple solution but I don't know where to search anymore. In general, I'm a Windows programmer, but I started programming for Android about 4 months ago. I've developed a fairly extensive application. The problem began when I started programming...my spinners are the solid gray rectangular style (unlike the newer style with the triangle in the lower right corner). When I started developing this app several months ago, I couldn't figure out why my spinners were different (after many hours) so I just ignored it. I'm at the point now of polishing my program and want the newer spinner style. So, I'm beating my head against the wall again. I went to my Android SDK Manager in Eclipse and updated my Android SDK Tools, Platform-tools, and Build-tools. I have the latest versions of all of these (22.3 and 19.0.1). When I create a new project, the newer spinner style appears. However, none of my older projects changed. They still have the same old gray, rectangular type spinners. I tried using a "android format" line command I found while Googling, but no luck with that either. I know there is probably something really simple I can do, but I can't find it. Can anyone help me with this? I'm using ADT Bundle with build v22.2.1-833290 on a Mac OSX Mavericks.
Newer spinner style works from API level 11.
So, you have to run in Android 3.0 and higher devices. If u want the same style in below 3.0 versions, then you have to customize your style. Like, take that newer style type of image and apply as a background to the spinner.
Try using ActionBarSherlock in your code. This will give you an advantage to have actionbar in lower versions of android. Also it contains ICSSpinner(An alternative to androids default spinner), which will give the newer look of spinners in lower versions of android.
Here's the link for ActionBarSherlock
http://actionbarsherlock.com/
Need to create an application in a below mentioned link format targeting all the android platform i.e. from 1.5 to 4.1
http://natieklopper.blogspot.in/2011/08/iphone-styled-bottom-aligned-tab-bar.html
Can I use tab activity class for the same? Know it is deprecated but still need to confirm if we use then will my application work on all android devices.
Not getting appropriate demo or example to start my application with fragments,action bar sherlock's tab.
Please suggest me a simple way to initiate my application. Really appreciate if some examples are available.
Your application will work in all android devices if they have a newer version than 1.5
Deprecated means obsolete, but you can continue using ;)
I am new to android. My minimum API level needs to be 7, so that I can test the app on my htc hero. My target API level is 17.
The error concerns the actionbar. Some code is added by eclipse and I guess I need it to propperly run my app on the latest android versions:
getActionBar().setDisplayHomeAsUpEnabled(true);
getActionBar() gives NPE on API 7, but not on API 17. How do I solve this without deleting the code (which I will presumably need for modern API levels)?
Basically, You need to follow this. If You need some good example, I think Android IO app source might be a good example on how to develop taking care about form-factor, API level etc. during runtime (however, it might be little bit difficult for completely new to android)
Action bar is not supported in any pre-honeycomb versions so any method related to action bar will not get executed....but after searching SO i came across this brilliant thing...
just check this out...
You can find out more information as well as screenshots of sample applications at link
The library is 100% open source and available at check this
from below question...
ActionBar pre Honeycomb
i think your device have android version 2.1 thats why you get error.
just add this actionbarsherlock lib to your Project.
after that just change this line
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
check this tutorials link and link