I am trying to set an image as background. I edit the xml layout file. But when i put the image on the drawable folder, it gives an error on the project name. What is the problem? Is it related to size of image? How much is the biggest size for image that android can run?
Probably your image name is incorrect , resource items cant have numbers , special characters ( _ is fine ) & upper case characters.
Image Size never give Errors, Format of the size will give the error.. Check the valid format..
If you upload the bigsize image , it display only small portion from Display.getWidth to Display.GetHeight position.
Related
As i understand template matching finds areas of an image that match (are similar) to a template image (patch) according to
this
So i have two images of different dimension. And when i am trying to match my template image with the source image it usually marks the wrong area in the image.
Source Image
Template image
Output image
It works fine with threshold value if the images are of same dimension. What needs to be done to overcome this problem?? Or can i use template matching in this scenario??
I was trying to incorporate a image as a splash page for my android app. This image was created by one of my friends using photoshop. When I try to use this image as a background for my android application it says : "Exception raised during rendering: Numbers of source Raster bands and source color space components do not match" . Is there a way to fix this image non programatically, i.e. using photoshop or any other tools. If not is there any thing which can be done programatically.
This most probably is due to Bit Depth Field may be or any other image related properties because of which Eclipse IDE/ ADT is not able to render the image into ImageView.
The work around i use to convert same image into other format, In my case image was image.jpg which I converted to image.png using the Online Image Editor - Pixlr Editor
Hope this helps!!
i am developing kids 1 to 100 learning number speaching application. here i used nearly 100 images used to refer the every images.
i have two two levels. dynamically creating buttons, runtimely load images into buttons here.
one is for number showing with images level.
another one is for alphabetic with images showing level.
totally i used 150 images from drawable folder.all images are PNG format with width and height is nearly each one 240 into 210 like that..
when i click NUMBERS level button , that part working fine. when i get back second alphabetic level its completely application crashed.
Error is: Out of Memory error only..
I refered this stack link : Strange out of memory issue while loading an image to a Bitmap object
they told like, get the image and decode and load it into drawable.
here exactly i dont know , how to get image from drawable and load into bitmap and decode the image and set into dynamic button..
note: here i dynamically created 100 buttons using for loop, that time, i need to load images.
i created successfully everything. when i run the program, i am getting memory error.
please help me solve this issue..
I Solved this problem using android:largeHeap="true" in application tag in AndroidManifest.xml
I have one big image named panel_bck.jpg to use in different resolutions to decrease apk size. The image format is JPG and it's size is 1.9MB. I put it to default drawable folder only. But when I set the background in code, the BitmapFactory can't find the image at
drawable/panel_bck.jpg
and the result is all black background. I tested this case with other images(PNG files, JPG files) and there is no problem with them. Only question is that a limitation exist for the drawable size or what is the problem? How can I solve this?
If your image very big resoulation you will set drawable-xxhdpi directory only.
I had a problem like yours trying to maka a big image fit into a too small ImageView and I fixed my problem by using this line in the layout xml file:
android:adjustViewBounds="true"
I don't know if it can ba applied to an activity background though.
You should use 9patch image. You can create 9patch image by using the tool called draw9patch located in sdk/tools. First create a large resolution image and give to draw9patch it will create a 9patch image with extension .9.png add that image in drawable it will solve you problem.
See following links for detail
http://developer.android.com/tools/help/draw9patch.html
http://codesignature.com/how-to-design-9-patch-buttons-for-android-using-adobe-photoshop-for-all-pixel-densities-and-states/
My Problem: Only one image will actually load from the assets folder. I have all the images there and when I try to access any of them I don't get an error. By actually load I mean it shows the image on the screen. When I load the other images the whole screen comes up white.
In every instance I am loading the whole image to the whole screen.
If I were to put the image as a fourth its size in the middle of the screen then there is a white rectangle there. The image is supposedly in the .apk because I don't get an error for the game trying to find it. However if I were to load this one image then everything words fine.
The one image that works find is a .png image and I tried to load the others as a .png but it does not work.
Any advice on where to start?
I load the images through the AssetManager.readAsset() as an input stream and then use the bitmap factory to get the image as a bitmap. Afterwards I load the bitmap into open gl and draw the region I want. However, the problem is only my first image I ever started using works at the moment. Could there be something wrong with a file that eclipse generates?
Some png bug android.
Just try to open them and save them with gimp. Sometimes it solves the problem.
Finally found the solution.
Turns out that one image that worked had a bit depth of 32 and the other ones only had a 24 bit depth.
The solution is to open up the image in gimp, add an alpha channel (makes it 32 bit), and save it as a .png file. Then read the details and it should say it is 32 bit.
Thanks guy! :)
Also note that images have to be by power of 2. For example it needs to be 1024 by 1024.