Pixels Of Background Image Looks Blurry When Using Its Attribute For Layout / How To Do This

When i am using the background attribute for a layout, the pixels of the background image looks like blurry. I think there must be a resolution problem. For example in api demos there is a module in this path graphics/bitmapspixels. My background image is looks like a third image. I would need to show my background image like the second one. How to do this?

View Full Post With 1 Replies

Related Forum Messages:

Please Follow Index to Quick Jump to the Message.

Memory Leak In Layout With An Image File Statically Linked As Background

My friend was quoting as said below. Can somebody validate his statement whether it is true.

Quote :

Apparently there is a problem in ui framework with drawable resources management. If an activity uses a layout with an image file statically linked as background (and possibly some other attributes), every time the activity is created, a new bitmap object is generated and never gets released, which eventually leads to out of memory exception.

I created a simple test app, which uses a really big png file (850kb, 1650x1275px) set as background in the activity's main layout xml. After two attempts of screen orientation change, on which event the activity gets destroyed and then recreated, the application crashed with the subject exception. Recycling the background bitmap object in the activity ondestory() method, like shown below, solved the problem.


So we either need to fix it on the framework side, so that when an activity is destroyed, all drawable objects associated with it are released as well, or we need to make sure that all static images are handled by all the applications in a proper way and all drawables are recycled explicitly.

Posted On: Sep 11 2009 . View Related Posts . . View 2 Replies .

How To Know In Which Pixels Of A Image User Clicked

I want to draw a image filling the complete screen.
Then when user clicks in any pixel or group of pixels they turn black.
How can i know where the user clicked exactly and how can i turn the touched pixels black?

Posted On: Sep 6 at 18:26 . View Related Posts . . View 1 Replies .

Unable To Access Pixels Of A Bitmap Image On Droid / Solution For It

In short i am unable to access all the pixels of a bitmap image.

I have used an intent to fire the native camera app and returned a bitmap image to my application activity. The data is definitely a bitmap object and i am able to display, get the height/width etc and access some pixels using getpixel(). However when i use the values of getheight() and getwidth() i get an array out of bounds error. By trail and error i have found i can only access a reduced number of pixels of the image, for example with one image which returned a height and width value of 420, 380, i could also access 200, 100. I then do some image processing and used setpixel() on the original image. When i display the image it shows the, say 200, 100, processing pixels and the rest normal, therefore the pixels are obviously there and accessible by android but not by me. I have to spoken to other people who have also had this problem with images.

Does anyone know anything more about this, reasons? Or a work around?

Posted On: Nov 20 at 15:04 . View Related Posts . . View 2 Replies .

Background On Layout Is Scrunching Contained Content

I have a linearlayout that i set a background to a 9-patch drawable. It appears that the linearlayout is somehow forcing its contents to display within the center space defined by its background. This is really creating problems as the content is being "scrunched" or compressed to a much smaller space that what i anticipated. I donot have any margins or padding set on the linearlayout so i know the only place it could be getting this is from the background. All i wanted was for the background to be a background and not some how contribute to how the linearlayout laid out its views. Is there a way to tell the linearlayout not to pull sizing information from its background?I see that the class ninepatchdrawable has a getpadding() but no setpadding(). I assume that the linearlayout is getting the padding from ninepatchdrawable and using that to contrain the contents of the layout to a smaller area. Can i override this without subclassing this class?

Posted On: Feb 6 . View Related Posts . . View 9 Replies .

Set Background Of Main Layout Screen From A File On Sd Card

I want to set the background of my main layout screen from a file on the sd card? Been searching but i cant work out how to achieve this.

Posted On: Mar 6 . View Related Posts . . View 2 Replies .

Image Button Background Never Changes

The image button background never changes (normal, focused, clicked. ) I'm using an image button and trying to different background image when normal, focused and clicked. I have read quite a lot of posts related to this and have implemented exactly as suggested.

Also kindly let me know will the focus works in the emulator when focused using mouse.

Posted On: Sep 24 . View Related Posts . . View 6 Replies .

Tile Bitmap - Bitmap As A Background Image In App

I'm trying to load a bitmap in android which i want to tile. I'm currently using the following in my view to display a bitmap: canvas. Drawbitmap(bitmap, srcrect, destrect, null)

I essentially want to use this bitmap as a background image in my app and would like to repeat the bitmap in both the x and y directions.

I've seen the tilemode. Repeat constant for the bitmapshader class but am unsure if this is to do with repeating he actual bitmap or to do with applying a filter to the bitmap.

Posted On: Aug 21 09 at 9:56 . View Related Posts . . View 4 Replies .

Motorola Droid X - Blurry Wallpaper In Handcent Sms / Fix It

Whenever i set a wallpaper for hancent, the picture is very blurry and distorted. I am sure that the pictures i am using are very high quality, that is not the problem.

Posted On: 08-02-2010, 11:54 PM . View Related Posts . . View 1 Replies .

To Save Resources / Should Services Use Android:process Attribute

I have a service that runs continuously. I opted to run the service in a separate process, communicating through ipc with the client activities, thinking this will help conserve memory. If the user is done interacting, android could shut down the entire client side process. However, the protocol between the service and activities is actually a bit complex, and writing all that ipc code is a bit tiresome.

Is there actually any gain here? If android frees the memory of finished activities anyway, is there any benefit to using a separate process, or is it maybe making things worse, even? What about a stopped activity stack (i.e. The user leaving through home)? If there are two processes, android could shut down the client side to regain memory. With a single process, would it need to choose between either ending keeping the saved activity state in memory, or ending the process including the service? I can't help but notice that no other app seems to use a remote process, including builtin one's like google talk or the music player. I'm i correct in assuming that this is the recommended approach then?

Posted On: Apr 12 . View Related Posts . . View 3 Replies .

Get Real Width Of Pixels Of A String

The string contains different kinds of characters.

Posted On: Jan 28 . View Related Posts . . View 2 Replies .

Copy Pixels From One Bitmap To Another Shaped Like A Circle

I am using setpixel and getpixel functions but they are using matrices which is naturally rectangle. I am trying to copy pixels shaped like circle !

Update :
Now i am using this but i hope there is something more efficient than this one code.

Posted On: Oct 28 at 16:43 . View Related Posts . . View 2 Replies .

Qvga Screen Hides Some Pixels - Solution For This

I have a problem with missing pixels on qvga screen on android (all versions including 2. 2). The original problem was with linearlayout and margin="1px". It was ok on the normal screen but on qvga there was sometimes no space between gui controls, like if margin="0px" and not 1px. So i tried to make the example simple (to be sure that it is not a linearlayout bug), i have just put transparent (height = 10px) and white (height = 1px) images into imageviews into the main screen. 25% of the white images are not shown on the qvga screen. The behaviour on the normal screen is ok. The screenshots are from the emulator but the problem exists on real devices too.

See screenshots on my web page.

Is it an android bug? Can i do anything with it? Note that my original problem was with linearlayout and margin="1px". Is there something like margin="1px_that_is_not_hidden"? (Pt, dp, dip, . Don't seem to be solution

Posted On: Sep 16 at 8:59 . View Related Posts . . View 1 Replies .

Format Attribute Value "droid:drawable" Not Valid / Fix It

I'm trying to create custom attributes to my button but i don't know which format i must use to images in attributes declaration.code.

Error is in the format="android:drawable".

Posted On: Aug 15 at 11:54 . View Related Posts . . View 1 Replies .

Unable To Click On Regions Of 1st Image Where 2nd Image Overlapping / How To Do

I have 2 imageviews which have animationdrawable backgrounds to animate a box opening and closing when you click on it. The 2 images are slightly overlapping (the transparent area) so they can be closer together.

The problem this is causing is that i am unable to click on regions of the 1st image where the 2nd image (transparent area) is overlapping.

Is there a way to set a clickable region of an imageview?

Posted On: Aug 13 at 9:02 . View Related Posts . . View 1 Replies .

How To Run Background Activities

My app runs on a 1 hour timer. I'd like it to run even if it's not in the foreground, and even if the phone is asleep, preferably even if the app isn't even running. I tried to accomplish this via alarmmanager and services. The alarmmanager just seems to queue the process because nothing happens until i bring the app to the foreground, then it runs multiple times depending how long it was inactive.

Services seem to require a separate application which is the service, but even if i could get that to work (which i can't) wouldn't the user have to download both my application and the service from the android market, thus making them install two things? How do i accomplish what i am after? Please note the application extends activity so it can't itself be a service, as far as i know.

Posted On: Mar 11 . View Related Posts . . View 2 Replies .

Where To Get App To Use Several Of Pictures And Background

Was wondering if anyone knew of any background app that would let me use several of my pics and the background. Not sure how i am trying to word it- but i guess i am meaning that the background will flash diff pics instead of just the one that you go in and set up thru the setting?

Posted On: 07-17-2010, 05:43 PM . View Related Posts . . View 4 Replies .

Set Left Background Of An Textview?

I have a text view. I would like to add a 'vertical line' on the left side of the textview to act as a separator.

Is there a way to do that?

Posted On: Apr 19 at 23:09 . View Related Posts . . View 1 Replies .

Supplying Different Background Drawable For Dialog

I'm trying to supply my own background drawable for a dialog. It works fine on 1. 6+, on 1. 5 though instead of a transparent dimmed background around the dialog, i just get opaque black. Is there something else we need to do so that we can still get the transparency around the dialog? The drawable is nothing special, i just took the stock one from the aop and changed the color on the inside of the frame.

Posted On: Mar 11 . View Related Posts . . View 3 Replies .

Shop Savvy Running In Background / Solution For This

I've had shop savvy installed for 4 months and haven't used it for a while (at least 1 month). Yesterday i noticed that it accounted for 3% of my battery usage. Anyone else see this?

Posted On: 10-20-2010, 06:58 AM . View Related Posts . . View 2 Replies .

Handle When App Goes To Background And Then Back To Foreground

I have a surfaceview setup and running, but when i resume it i get an error that the thread has already been started. Whats the proper way to handle when the app goes to the background and then back to the foreground? Ive tinkered around and managed to get the app to come back without crashing. But the surfaceview doesn't draw anthing anymore. My code.

Posted On: Aug 20 at 1:41 . View Related Posts . . View 2 Replies .

Remove Background Color Of A View In Droid

Removing background color in android

I have set backgroundcolor like this in code, view. Setbackgroundcolor(0xffff0000);

How to remove this background color on some event. ?

Posted On: Oct 29 at 10:31 . View Related Posts . . View 1 Replies .

How To Programatically Push My App To Run In Background

How can we programatically push our app to run in background? I am doing one browser app. And when i am directly launching my application and clicking back key . It will show in the list of background running process. At this time category is "category_launcher" but at the same time if we try to run same app via third party app. And then clicking back key, its not showing in the list of background running process. Here the category is "category_browsable". And its not displaying in the list of running process. I noticed that the same behaviour in default android browser. But is their any way to make my app to run in background by clicking back key without killing my application?

Posted On: May 31 . View Related Posts . . View 6 Replies .

Run A Service In Background Forever On Phone

I am doing a battery consuming research on the android phone. I want to run a battery check every 10 min till the battery totally dies. I have been having problems to make it work.

At my first try, i use a timer in a service class, and schedule the battery check every 10 mins. But soon i found that the service got paused when the screen goes off.

Then i try to use alarmservice, i use a alarm call to wake my service every 10 mins and to check the battery level and save the data to a file on the sdcard. It works with the screen off. However, i only got data of 9 hours. It seems that the alarmservice stop at some point after several hours. I don't know why it is like this, has the system killed it for memory issues?

So my question is, has anyone written some service to run (like forever) in the background before? How do you do it and i'd appreciate very much for a sample code?

I am currently reading some posts saying that there's a partial wake lock i can use to keep the service alive. Is this the correct way to do it?

Posted On: Feb 23 at 23:44 . View Related Posts . . View 2 Replies .

Send Task To Background And Bring It To Foreground

I have this requirement to send my application background and then bring it to foreground on some key capture intents (not from application launcher offcourse) so how can i send the current tasks to background and bring the same to foreground ?

Posted On: Nov 22 at 14:28 . View Related Posts . . View 2 Replies .

Service - Download Files In Background - Freezed

I have a service which should download files in background, i am calling this service form another activity, the problem is when i am calling this service form another activity the present activity is getting freezed( i.e not able to get control back ) until the all files in service are downloaded. Once all the files in the service are downloaded the activity is getting the control back.

What i want is the the service should download all the files in background with effecting the activity which called the service.

Posted On: Aug 26 2009 . View Related Posts . . View 2 Replies .

Motorola Droid - How To Upload Custom Background

I've connected my droid to my pc, and dropped the png image i made onto the removable disk folder in my computer. But how do i find it on the droid and set it as a background now?

Posted On: Dec 25, 2009 3:25 PM . View Related Posts . . View 10 Replies .

Create An Application Which Has Service Running In Background

I am trying to create an application which has a service running in the background. But i should also be able to re run the service when i select option(here it is a check box) from the fore ground. I am getting unable to instantiate service error.

I have called the service in my main activity using


Where my context is got by using getapplicationcontext();

Posted On: Jul 6 . View Related Posts . . View 5 Replies .

App To Defrag - Clean All Stuff In Background

Is there such an app to defrag or clean all the stuff in the background?

Posted On: 11-27-2009, 12:55 AM . View Related Posts . . View 4 Replies .

Htc - Desire Shows All My Contacts In Background / Way To Not To See Them

When i press phone it shows all my contacts in the background, its so annoying, is there anyway i can have it so they don't show?

Posted On: 08-17-2010, 12:08 PM . View Related Posts . . View 1 Replies .