Orientation change: reloading layouts from resources - android

I want to adapt my app for tablets with large and xlarge screens (Android 3.0+ or API level 11+). Therefore, I created two folders: res/layout-large-port-v11 and res/layout-large-land-v11. When I first rotate my tablet and then launch the app, everything works well, but when I rotate the tablet while my app is working, Android stretches and rotates old layout, but doesn't load the proper one (proper for new orientation). What's wrong?
My tablet is Acer Iconia A500 (Honeycomb 3.2, API level 13)
You can see AndroidManifest.xml and all code in the app's repo on github. DashboardActivity contains all logic for tablets.
P.S.: Everithing still works pretty well on my Android 2.2 phone with normal screen. Maybe something wrong with qualifiers? Maybe I should also create -v12, -v13 -v14 and -xlarge duplicates of the two folders?

Have you tried removing orientation from configChanges? With this declaration, you are overriding the default behaviour of Android when changing orientation - this may (or may not) lead to problems like the one you described.

Related

Galaxy S9 not using proper drawable resources

I am working on development of a dark mode for an application in android studio. This application uses a custom background element for the EditText which I have called custom_edit_text. To be assured of backwards compatibility I have created a "layout" and a "layout-v29" folder for the dark mode changes, and similarly I have created a "drawable" and "drawable-v29" for the custom_edit_text.
This has worked for devices around the office and on the emulator, however a fellow employees galaxy s9 will not display the new drawable and instead defaults to using the "drawable" version of the custom_edit_text instead of the -v29.
What needs to be done so that the appropriate drawable ends up in the layout based upon the api version of the phone in question?
project resources
activity main v29
It is quite likely that the S9 does not support api level 29 as that equals to Android 10 which is quite new.
You would need to have a drawable-v26 to ensure the Galaxy S9 woulds work as they shipped with Android 8 I believe.

Will coding done in android 2.2 work in 4.1 Jellybean Phones?

I have wrote an application using android 2.2 in eclipse.
My app is working fine on the samsung galaxy mini android 2.2. However, it is not working on samsung galaxy s3 android 4.1.
My app is only taking up half of the screen on the samsung galaxy s3.
Why is my app not working on higher resolution devices?
How can i make the app compatible with other devices running
different versions of android?
Sounds like it's most likely you just have a LinearLayout at the top of your layout XML and it just takes up less space on the S3.
I would advise taking a look at the two links below; if you want a specific starting point, you could adjust your layout to match_parent and use the l/m/h/xhdpi folders to place different size graphics in. Also worth checking whether you are using dp or dip (density independent pixels)
http://developer.android.com/training/multiscreen/index.html
http://android-developers.blogspot.co.uk/2012/11/designing-for-tablets-were-here-to-help.html
The best way to ensure that your app will work on other devices is to get access to other devices and test your application on those devices before you release.
Another way is to make sure that you are targeting the correct SDK you need to target and use the AndroidSupportLibrary when needing to have backwards compatibility.
For us to help with your specific problem we would need more details as to what exactly is going on, but make sure the packages and libraries you are using are compatible with the android versions you are trying to target.
And make good use of the AndroidSupportLibrary.
Did you check the resolution compatibility? This seems more like an Android Manifest issue then an Android version issue.

Test a Gingerbread layout on Ice Cream Sandwich

I'm creating an application which works on Froyo until Jelly Beans. I have two layouts on for ICS and above and one for Gingerbread and Froyo.
I test my application on a device which it is on ICS so I see the ICS layout but I would like to test my other layout.
How I can do that ? I think I have to add an option in style.xml or androidManifest but I' not sure.
Thanks.
If you want to test your gingerbread layout but only have an ICS device, you can simply rename your layout folders so it will pick the gingerbread layouts on ICS. Switch the names of the layout-v10 and layout-v15 folders and it will load your v10 layout on your v15 device.
Also, you could use an emulator (running 2.3.3) to test your gingerbread layout. This would allow you to make several emulators with different screen sizes and see how your app would look on different devices. You can also test other things with this like SD-card status, hardware keyboards vs soft keyboards, etc. to ensure your app works with different hardware configurations.

Android phone and Tablet problem

I know this is not a technical related question.But i do not have any idea.I am going to develop a project which should be supported in both phone and tablet.Is it possible having one project working for both tablet and phone ?
Yes. The only thing you need to keep in mind where you keep your graphics. Because it will cause different problems if you do not treat and handle them depending on the screen size. Only thing matters is the android version. If you deploy your app in any phone or a tablet where the version is newer or equal to the target version it works. But of course you cant take a call or some other mobile functionality from a tablet if its not supporting that features.
You can use drawable-hdpi,drawable-mdpi and drawable-ldpi for the graphics(images which use in project) and also use layout with multiple screen by custom layout like layout-480x320 , layout-600x1024 etc. in layout you can custom screen xml file.

Screen display problem in Gingerbread

I have upgraded my Motorola Atrix to Gingerbread (2.3.4), so far with no issues. When I go for my old apps and games which I developed previously, those are not displayed fully in the screen, it is only giving a 320x480-pixel display. Do I need to change my code or my phone settings?
Given that you currently use android:minSdkVersion="1", try setting minSdkVersion="4" or setting anyDensity to true.
Both should have the same effect of allowing your app to scale beyond Android 1.0 screen sizes of 240x320; before SDK 4 (Android 1.6 ) the default was not to scale as there was only a single resolution.

Categories

Resources