What hd graphics really are - android

I am working on android app. I see lot of apps say they have hd graphics and i can see some difference in their graphics and mine. I searched on google also but cannot get exact answer as to what actually hd graphics means? Is it some kind of format like .png or is it resolution like 400*800. I mean if i want to make hd image of a simple button how can i do that? Can anyone please explain in deatail keeping android apps in mind. Thanks in advance!

Basically you need to check out the definition of HD. That stands for High Definition and it's main idea is that by making resolution big, on bigger screens the quality of an image or a video won't look bad.
About Buttons, in Android or any other OS most of the times vector graphics are used instead of bitmaps. Vector graphics are just some coordinates which make up graphic, so when you zoom in or display a vector graphic on a big screen it won't lose it's quality. Bitmaps are collections of pixels. Check this out to get a basic understanding of dpi and pixels: http://en.wikipedia.org/wiki/Dots_per_inch
In order to use bitmaps efficiently for buttons and that kind of controls I'd suggest taking a look at this: http://developer.android.com/reference/android/graphics/NinePatch.html

Related

android: best practice for custom background

I am new to android but an experienced Java and other languages programmer.
I need to create a custom background for the initial app activity. It's quite simple, here it is:
http://imgur.com/VrtrRo5
Should be pretty simple!
The best I could come up with is:
android:background="#drawable/background"
First, this was driving me crazy, I was always getting:
Binary XML file line #1: Error inflating class <unknown>
Searching, first hints pointed to a size issue - but the file size is 11kB! Then I found more hits and they essentially pointed to resolution. My image dimensions were 1080x1920px. I resized it to 768px (keeping ratio) and - voilá! - now it loaded.
However, I wonder if this is the correct approach. After many years of web development, I wonder if a "css-like" approach would be more suitable. If I use that image size, will it work fine for all devices and all resolutions? After all, it's just two colors (granted, with a curved element).
What are best practices for such cases? Thanks!
See this:
https://developer.android.com/training/basics/supporting-devices/screens.html
You should create diferent bitmaps for diferent resolution and screen density.
The best practices for this come in understanding the following 3 parts of application development and design: how to handle bitmaps, how to provide resources, and who is the target for your app.
Starting at who is the target of your app is not just the person but the devices they tend to use and the devices you want to support. In your question you mentioned that resizing the image to 768px prevented the error from occurring but that error happened because 1080 (at 16:9) resolution are rather large images when decompressed. So your own development device is not capable of handling a rather large image. Which is 8M when decompressed as ARGB, the 768px image is just above 4MB. So you can see that there is a significant memory difference. In addition to considering memory sizes you may consider screen size differences, image for a moment if you had a 800x480 image being displayed on a very capable 2048x1536 display, not considering memory usage a scaled image would look very jagged and the aspect ratio would be flawed, even worse would be if the device's orientation changed.
The conclusion is to provide the graphics for the kind of devices you want to support. Providing these resources is a matter of understanding how apps organize their resources.

Target resolution for a game (Android)

So, we're developing a game and the artist asked in what resolution is he supposed to prepare the graphics.
I've done some research
http://developer.android.com/guide/practices/screens_support.html
developer.android.com/about/dashboards/index.html
and from what I gather I should ask him for 1920x1200 resolution graphics, and then
from these I can prepare graphics for lower resolution devices.
That would be a major screw-up if I asked him for wrong resolution art so I want to make sure.
Is that the case ? When he does these 1920x1200 graphics, am I going to be able to produce all the other popular sizes/resolutions with no problem ? My biggest fear are ratio differences.
Thanks.
If clipping isn't a concern, you can use 1920x1200. However, you'll have to do some editing for different aspect ratios, like you guessed.
I would create a large one for each target aspect ratio, if that is your concern. The most common ones are probably 16:9, 15:9, 4:3, but you might want to do some research on what your focus devices are.
If you have one in each aspect ratio, it makes scaling easier. However, the artists I've worked with generally provide me more than that, since a general scale doesn't always look good in a l/mdpi setting. They normally work with vector graphics for the base images, and then can scale to whatever resolution and put it in a raster format. You might want to ask your artist about that, though, since I'm not much of an expert on it. All I know is he sends me pretty pictures in many different resolutions.
All in all, though, aspect ratio isn't very important for most graphics. A fullscreen background, maybe, but all your UI components should be fine with just an mdpi/hdpi/xhdpi version.
Please use larger graphics. The accepted answer is alright for year 2013 when it was posted, but there are devices with 2560x1600 now and graphics don't look sharp and crisp on them.
If you want to support everything properly and make your life easy, ask the artists to supply everything in at least 2733x2134 pixels (for fullscreen images like backgrounds, etc.) You can use smaller sizes for sprites (just calculate which percentage of the screen it would occupy).
BTW, that 2733x2134 might look odd, but it was carefully calculated. See the details here:
http://bigosaur.com/blog/31-android-resolutions-definite-answer

Making a low res image look good

I'm displaying images from various of sources, and can't control the quality I get, I want to display all images in same size and make them look good no matter how small they are.
Is there a filter, magic effect, whatever I can do to the image to make it look good?
You mean fitting a low-resolution image into a large frame size and still look good and sharp? Android doesn't have this magic. Sorry
You could apply a blur effect on your image, which is what most modern browsers and image viewers do nowadays in order not just to show a big block of pixels - not sure what your scenario is though (native or HTML5 app ? Are the images bundled into the app or are you loading online resources?)...
For starters, here's a nice tutorial on different blur techniques incl. java code samples (Found in this post).
The closest thing Android comes with is to use paint.setFilterBitmap(true) for the paint you use to draw the bitmap.

Better way for Andengine screen size?

I understand that Andengine gives us option to scale our scene to any size screen that the user may have.
My question is if it would be better to develop for a larger resolution, say 1280/800 and scale it down for smaller screens OR to go for smaller resolution, say 800/480 and scale it up on bigger screens?
I did try to test this in a sample game by developing it for 1280/800 and scaling down (by ratioResolutionPolicy) to 800/480, and the results weren't satisfactory, there was stutter every here and there the framerate on the debugger though showed 60+. Is it bad programming on my part or does it have to do with the scaling down of the pixels, should I develop for smaller screen and scale it up?
I guess it depends on what kind of graphics you are using.
Say, for example, you want to create something in a retro-gameboy-pixel style, then it makes more sense to use small images and develop for a small resolution (like 480x320). Pixel graphics can be scaled up without loosing quality, but not down (then the pixels loose form).
But if you want high resolution graphics you are most likely better of developing the whole thing for a big resolution and let the AndEngine scale it down.
In both cases the quality of the pictures also depends on the TextureOption of your TextureAtlases as well.
Anyway, I can imagine that neither scaling down, nor scaling up is more efficient. Scaling is done by openGL and should go quite quickly. The downside of using big resolutions though, is that the device has to hold huge images in it's memory and the of course processing big images always takes more time than processing small images. So maybe the best way is to develop for middle-size devices (e.g. 960x640) ?
I know this isn't much help, unfortunately it is a lot of try and error to get the best results for your specific requirements.
christoph
To achieve good result on all type of android device you have two ways to follow from my perspective.
First, you have to develop and use two graphics to handle all the type of devices. For example one with resolution 1024x600 and other with 480x320. Based on device current resolution you have to load specific one type of graphics.
Second, you choose any single resolution that best suits to you and have great share in the market. Develop and use graphics only for that resolution. For other resolution scale that graphics based on aspect ratio. For this you have to create super class of sprite and change value of x,y,height and with based on aspect ratio calculate.
This was my experience that I share with you. If you have any doubt then feel free to ask it.

Image management and scaling

I am developing a live wallpaper and I would like to know how to manage high quality images. I am quite new to android development by the way.
I got 2 questions:
1)The image I use for wallpaper creation is a vector image (2560w x 1600h, 32bit, 10mb exactly), very crispy and with really high resolution. I tried it as a wallpaper and it looks just fantastic (on my tablet). I placed it in the drawable folder. This results in a high dimension .apk file (9 Mb). Is it ok to have files this big enlarge apk dimension or it is a good practice to reduce it as much as possible?
2)When building my wallpaper from the Engine class i'd like to know, after setting the above image as a wallpaper, what is the best practice to scale it fitting XY independant of screen sizes.
PS: What i found to be perfect was the default system android use when you attempt to set an image as wallpaper. What does the system do in that case?
Thanks :)
1.)Since no android device supports resoultion bigger than 1280x760 of what I know, it is not a good practice in having images with bigger size than this as they use a lot of space for nothing.
2.)The DisplayMetrics class has everything you need related to this problem.

Categories

Resources