Android AVD- modifying API level, changing the APP view - android

Hi I was using Google API level 7 for my App.
I coded all layouts in dip unit. Now I installed Google API 8, changed my project to use level 8.
But, after launching the App, getting modified view. For e.g- the length increased for a list-view. Also, service call is not working. Restarting eclipse didn't solve the issue.
Then again switched back to Google API 7, now the service calls working fine. But, having layout issues like- font-size got bigger and list-view having increased height.
so, is there anything am missing? or why the layout is changing in different API Level! I don't have a device; will all the element measurements change in device?

which layout are you use? if linear layout then no problem because when you check it on device it will get in proper manner.now you got problem of size of emulator so click on avd > click on avd item(Google api 8) > click edit button > set built in : HVGA >edit AVD > then run
dont worry check it in device it will get properly.

Related

App interface different in Android Studio and Emulator

An Android App development beginner here. I created a simple app which converts KMs to Miles and vice versa. Issue seems to be with the interface. The interface for activity_main.xml is as below:
Interface on Android Studio compiler
But once I emulate it on an Nexus 6 API 29 emulator, it looks weird and doesn't work properly. Tried it on a Nexus 5 emulator as well, same issue. Here's a screenshot:
Nexus 6 API 29 Emulator
Moreover, when I tried installing the apk file on my Samsung Note 8, it doesn't install, even after changing the settings and allowing unknown apps to be installed. Please help.
Judging from first screenshot (red alert icons in "Component Tree" window) the issue is the fact that You did't constrained Your Views.
When using ConstraintLayout You can't just 'place' views in editor, they need to be constrained to something in order to be displayed in desired place.
For example: Your button with text "Convert miles to kms" should be constrained as follows:
left to parent left
right to parent right
top to EditText above it or to TextView "KMs".
But other views need to also be constrained to get desired behavior.
You can read about ConstraintLayout and how to use it in this tutorial from official documentation: https://developer.android.com/training/constraint-layout

canvas.drawText seems does not work properly in Android api >19

I have an issue that is making me crazy.
I created an Android library for a Custom gauge view of a car applicaction.
On this gauge view there's a scale with values drawn with function Canvas.drawText().
Everything was working fine when running whis view on devices with API 19 and 22, up to when last week I updated Android Studio 2.2.
Since that time the values on the scale are not properly written if I run it on a device with API >19. If I run it on device with API =< 19 everything is fine.
This is the test project that can be cloned from Github:
https://github.com/dequadelisonz/CarDashDemo.git
This is what I should correctly see (on device with API <=19):
And this is what I see on device with API >19:
As you can see in the 2 gauges there are only few digits in one of the two. All the other texts seems to be disappeared.
Hope someone can do the trick to fix this thing....
Thanks!
Fixed thanks to this post
https://stackoverflow.com/a/14989037/746068
It seems there is a bug on Android APIs > 15 so that text is not properly drawn on canvas.

No device screen in Android Studio

I'm having problems in Android Studio. I can't see device screen in activity_main.xml and fragment_main.xml, but as well I see it in content_main.xml. Also, I can't add any elements to screen.
In the preview pane of right side try changing your API level to some lower or higher API it will most probably solve your issue.

How can I define a user screen when using ADT 21?

I updated my ADT to 21 last night, but then I found that in the ADT XML Overlay tool, I can't define a custom screen(1024*768, mdpi). Could you help me?
After Update your ADT to version 21.
In Older Version each time you have to set Add Custom Screen if you want custom Device Configurations.
In ADT21 Oversion you can get this thing done by
open AVD Manager, u can define your custom screen in "Device Definition"
Alternative (Much Easier approach)
in Newest Version you Don't Need to Set Custom Device
Configurations from the above Suggestion as much easier way is available for it. you >Just Have to Make Emulator With your Device
Configurations and after you will see those Configurations with
Emulator Name Inside Graphical Layout of XML
like after Created my Emulator of Nexus7 Emulator with Android 4.2 with Name as "Nexus7_Android_4.2" i will get this Device Configuration in Graphical Layout of xml automatically.
Below is the Screen Shot of it.
Hope it will Help you.

How to emulate Nexus 4?

Is it possible to create an AVD to emulate the Nexus 4?
I am using Eclipse and I'm pretty sure I have updated all of the SDK tools etc, along with the 4.2 SDK/system Image etc.
However, when I open the AVD manager to add a new AVD, there no longer seems to be the ability to enter a custom resolution/density etc. There is a droplist containing several devices, but no Nexus 4, and no generic version with a resolution of 768x1200.
Am I just missing something obvious?
Thanks in advance for any help!
After Update your ADT to version 21.
In Older Version each time you have to set Add Custom Screen if you want custom Device Configurations as (if you want Nexus 4).
In ADT21 version you can get this thing done by
open AVD Manager, u can define your custom screen in "Device Definition"
Alternative (Much Easier approach)
in Newest Version you Don't Need to Set Custom Device
Configurations from the above Suggestion as much easier way is available for it. you >Just Have to Make Emulator With your Device
Configurations and after you will see those Configurations with
Emulator Name Inside Graphical Layout of XML
like after Created my Emulator of Nexus7 Emulator with Android 4.2 with Name as "Nexus7_Android_4.2" i will get this Device Configuration in Graphical Layout of xml automatically.
Below is the Screen Shot of it.
Hope it will Help you.

Categories

Resources