[android-developers] Drawable Query
I am working on a simple animation using the animation-list attribute. I have all my sequenced images in the drawable-xhdpi folder and the first line of my XML looks like this: item android:drawable=@drawable/animation_0 android:duration=30 / To keep things tidy, I decided to create a new folder called seq inside of the drawable-xhdpi and moved my images inside. Of course I got errors in my animation.xml file, so I changed the first line to: item android:drawable=@drawable/seq/animation_0 android:duration=30 / Still showing an error so could someone help. Thanks. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Drawable selector not working in Jelly Bean
Posted this on SO, but not getting much help, so thought I'd ask here. You can see all of the details on SO, but basically I have a drawable selector for my ListView that works fine in previous versions of Android except for Jelly Bean. I've narrowed it down to either state_selected or state_activated not working, as state_pressed is working. Has anyone heard of anything changing with Jelly Bean in regards to selectors? http://stackoverflow.com/questions/11661190/drawable-selector-not-working-in-jelly-bean -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] drawable-xhdpi-v9 ?
There isn't really anything special about xhdpi -- aapt just converts that to the appropriate density value (320 for xhdpi), and the platform since API 4 knows how to pick the best density given any numbers for screen density and resource density. On Sat, May 26, 2012 at 8:51 PM, Mark Carter m...@carter.name wrote: Do you just mean the density configuration in general? Surely Donut did not specifically know about xhdpi (which was only introduced in Gingerbread)? On 27 May 2012 10:53, Dianne Hackborn hack...@android.com wrote: There is no need to here, previous versions of the platform (down to API 4) know about the density configuration and will pick the correct density for you. On Sat, May 26, 2012 at 9:20 AM, Mark Murphy mmur...@commonsware.comwrote: On Sat, May 26, 2012 at 12:12 PM, Mark Carter wrote: When min level is pre-Donut, I remember there is a common approach to use drawable-ldpi-v4, drawable-hdpi-v4, drawable-nodpi-v4 (as well as drawable) for similar reasons. If I have an app with ONLY xhdpi resources and set the minimum level to 8, then I notice the drawable-xhdpi resources are still picked up (as opposed to throwing some kind of resource not found exception) on Froyo. This is convenient but not particularly bulletproof IMHO, not least because the Froyo device will have no idea what scaling xhdpi implies. :: smacks forehead :: My apologies. I misread your question. I thought you were saying that your minSdkVersion *was* 9, not was *less than* 9. With a minSdkVersion of less than 9, using -v9 for resources you only want used on 9 and higher is perfectly reasonable. Now, I haven't tested this, but I suppose that using drawable-xhdpi-v9 will stop froyo from seeing those resources at all and so give better-than-nothing runtime exceptions (which in most cases would show up pretty quickly). Correct. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training in DC: http://marakana.com/training/android/ -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] drawable-xhdpi-v9 ?
When using android:minSdkVersion less than 9, is it (or should it be) standard practice to use drawable-xhdpi-v9 instead of drawable-xhdpi? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] drawable-xhdpi-v9 ?
On Sat, May 26, 2012 at 11:05 AM, Mark Carter mjc1...@googlemail.com wrote: When using android:minSdkVersion less than 9, is it (or should it be) standard practice to use drawable-xhdpi-v9 instead of drawable-xhdpi? It is not standard practice, nor would I recommend it. You use a -vNN resource set when you need *different* resources for a given API level (or higher). -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training in DC: http://marakana.com/training/android/ -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] drawable-xhdpi-v9 ?
When min level is pre-Donut, I remember there is a common approach to use drawable-ldpi-v4, drawable-hdpi-v4, drawable-nodpi-v4 (as well as drawable) for similar reasons. If I have an app with ONLY xhdpi resources and set the minimum level to 8, then I notice the drawable-xhdpi resources are still picked up (as opposed to throwing some kind of resource not found exception) on Froyo. This is convenient but not particularly bulletproof IMHO, not least because the Froyo device will have no idea what scaling xhdpi implies. Now, I haven't tested this, but I suppose that using drawable-xhdpi-v9 will stop froyo from seeing those resources at all and so give better-than-nothing runtime exceptions (which in most cases would show up pretty quickly). Compile-time warnings (Lint) may be more appropriate though - I'll have to investigate how it handles this particular scenario. On Saturday, 26 May 2012 23:16:13 UTC+8, Mark Murphy (a Commons Guy) wrote: On Sat, May 26, 2012 at 11:05 AM, Mark Carter wrote: When using android:minSdkVersion less than 9, is it (or should it be) standard practice to use drawable-xhdpi-v9 instead of drawable-xhdpi? It is not standard practice, nor would I recommend it. You use a -vNN resource set when you need *different* resources for a given API level (or higher). -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training in DC: http://marakana.com/training/android/ -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] drawable-xhdpi-v9 ?
On Sat, May 26, 2012 at 12:12 PM, Mark Carter mjc1...@googlemail.com wrote: When min level is pre-Donut, I remember there is a common approach to use drawable-ldpi-v4, drawable-hdpi-v4, drawable-nodpi-v4 (as well as drawable) for similar reasons. If I have an app with ONLY xhdpi resources and set the minimum level to 8, then I notice the drawable-xhdpi resources are still picked up (as opposed to throwing some kind of resource not found exception) on Froyo. This is convenient but not particularly bulletproof IMHO, not least because the Froyo device will have no idea what scaling xhdpi implies. :: smacks forehead :: My apologies. I misread your question. I thought you were saying that your minSdkVersion *was* 9, not was *less than* 9. With a minSdkVersion of less than 9, using -v9 for resources you only want used on 9 and higher is perfectly reasonable. Now, I haven't tested this, but I suppose that using drawable-xhdpi-v9 will stop froyo from seeing those resources at all and so give better-than-nothing runtime exceptions (which in most cases would show up pretty quickly). Correct. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training in DC: http://marakana.com/training/android/ -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] drawable-xhdpi-v9 ?
There is no need to here, previous versions of the platform (down to API 4) know about the density configuration and will pick the correct density for you. On Sat, May 26, 2012 at 9:20 AM, Mark Murphy mmur...@commonsware.comwrote: On Sat, May 26, 2012 at 12:12 PM, Mark Carter mjc1...@googlemail.com wrote: When min level is pre-Donut, I remember there is a common approach to use drawable-ldpi-v4, drawable-hdpi-v4, drawable-nodpi-v4 (as well as drawable) for similar reasons. If I have an app with ONLY xhdpi resources and set the minimum level to 8, then I notice the drawable-xhdpi resources are still picked up (as opposed to throwing some kind of resource not found exception) on Froyo. This is convenient but not particularly bulletproof IMHO, not least because the Froyo device will have no idea what scaling xhdpi implies. :: smacks forehead :: My apologies. I misread your question. I thought you were saying that your minSdkVersion *was* 9, not was *less than* 9. With a minSdkVersion of less than 9, using -v9 for resources you only want used on 9 and higher is perfectly reasonable. Now, I haven't tested this, but I suppose that using drawable-xhdpi-v9 will stop froyo from seeing those resources at all and so give better-than-nothing runtime exceptions (which in most cases would show up pretty quickly). Correct. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training in DC: http://marakana.com/training/android/ -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] drawable-xhdpi-v9 ?
Do you just mean the density configuration in general? Surely Donut did not specifically know about xhdpi (which was only introduced in Gingerbread)? On 27 May 2012 10:53, Dianne Hackborn hack...@android.com wrote: There is no need to here, previous versions of the platform (down to API 4) know about the density configuration and will pick the correct density for you. On Sat, May 26, 2012 at 9:20 AM, Mark Murphy mmur...@commonsware.comwrote: On Sat, May 26, 2012 at 12:12 PM, Mark Carter wrote: When min level is pre-Donut, I remember there is a common approach to use drawable-ldpi-v4, drawable-hdpi-v4, drawable-nodpi-v4 (as well as drawable) for similar reasons. If I have an app with ONLY xhdpi resources and set the minimum level to 8, then I notice the drawable-xhdpi resources are still picked up (as opposed to throwing some kind of resource not found exception) on Froyo. This is convenient but not particularly bulletproof IMHO, not least because the Froyo device will have no idea what scaling xhdpi implies. :: smacks forehead :: My apologies. I misread your question. I thought you were saying that your minSdkVersion *was* 9, not was *less than* 9. With a minSdkVersion of less than 9, using -v9 for resources you only want used on 9 and higher is perfectly reasonable. Now, I haven't tested this, but I suppose that using drawable-xhdpi-v9 will stop froyo from seeing those resources at all and so give better-than-nothing runtime exceptions (which in most cases would show up pretty quickly). Correct. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training in DC: http://marakana.com/training/android/ -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] drawable resolution problem
Hi, I am having an image in my drawable and drawable-xhdpi folder. When I run the build on a hdpi device, it picks image from xhdpi folder. I am not able to understand the reason behind it. As per my assumption it should pick from drawable folder. Please help. Thanks -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] drawable resolution problem
As per my assumption it should pick from drawable folder. As per your assumption you are wrong... :-) http://developer.android.com/guide/topics/resources/providing-resources.html#BestMatch Thanks, Justin Anderson MagouyaWare Developer http://sites.google.com/site/magouyaware On Thu, Apr 26, 2012 at 8:16 AM, nikki nikhileshsingh...@gmail.com wrote: As per my assumption it should pick from drawable folder. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Drawable set on an ImageView ignores setBounds and reverts to original bounds on orientation change.
I've been struggling with this strange problem for quite some time. A brief summary of the issue is this: An ImageView's Drawable in portrait orientation with a certain bounds set on it, on changing orientation and returning to portrait, does not retain the set bounds. Instead it reverts to its original bounds. This is in spite of forcefully setting the explicit bounds on orientation change. Do note that any bounds that you later set on Click etc are obeyed. I worked around this by abandoning the ImageView in favor of a custom View object and setting the Drawable using drawBitmap() within onDraw(). But could anyone point out what I was doing wrong in the ImageView approach? Links describing the issue in detail: 1) StackOverflow thread - http://stackoverflow.com/q/9237932/570930 2) Sample project illustrating the issue, a debug version which logs in more detail, and my solution involving custom View - Uploaded on Google Project Hosting - http://code.google.com/p/android-drawable--invalidation-on-orientation-issue/downloads/detail?name=InvalidateDrawable_2012_FEB_14_01.zipcan=2q= Thanks in Advance Regards, Kiran Rao. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Drawable in a String
Try Html.fromHtml(Here is an img src=\\http://www.foo.com/something.png\\;) and using that SpannedString result in your TextView. I might have the Java quoting rules messed up here, as I'm typing that from memory. On Wed, Apr 20, 2011 at 2:04 PM, pennstate24 eddiepwnsn0...@gmail.com wrote: I'm trying to get a Drawable image to show up in a String or CharSequence and all I'm getting is the integer number of the image. Can anyone please help me out with this? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android 3.0 Programming Books: http://commonsware.com/books -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Drawable in a String
I'm trying to get a Drawable image to show up in a String or CharSequence and all I'm getting is the integer number of the image. Can anyone please help me out with this? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] drawable in xhdpi not getting picked up
I am trying to get an app that currently runs just fine on hdpi and lower devices to work on the new XOOM that has xhdpi. I have a png image in my /drawable folder and a replacement in the /drawble-hdpi-v6 folder. On the XOOM, the version in the /drawable folder is getting picked up. I tried creating an /drawable-xhdpi folder with a replacement image. That did not work. I tried creating a /drawable- xhdpi-v8, that did not work. I tried /drawable-xhdpi-v9, that did not work... What do I need to do to get the XOOM to pick up the correct image. I guess I just assumed it should have picked the version in the hdpi folder since that would be closest, but that did not happen. My manifest has the following settings, uses-sdk android:minSdkVersion=4 android:targetSdkVersion=9 / supports-screens android:smallScreens=true android:normalScreens=true android:largeScreens=true android:xlargeScreens=true anyDensity=true / Thanks, Mark -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] drawable in xhdpi not getting picked up
Xoom is not xhdpi. It is mdpi. On Thu, Feb 24, 2011 at 3:34 PM, Mark Nuetzmann mark.nuetzm...@gmail.comwrote: I am trying to get an app that currently runs just fine on hdpi and lower devices to work on the new XOOM that has xhdpi. I have a png image in my /drawable folder and a replacement in the /drawble-hdpi-v6 folder. On the XOOM, the version in the /drawable folder is getting picked up. I tried creating an /drawable-xhdpi folder with a replacement image. That did not work. I tried creating a /drawable- xhdpi-v8, that did not work. I tried /drawable-xhdpi-v9, that did not work... What do I need to do to get the XOOM to pick up the correct image. I guess I just assumed it should have picked the version in the hdpi folder since that would be closest, but that did not happen. My manifest has the following settings, uses-sdk android:minSdkVersion=4 android:targetSdkVersion=9 / supports-screens android:smallScreens=true android:normalScreens=true android:largeScreens=true android:xlargeScreens=true anyDensity=true / Thanks, Mark -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Drawable from createFromResourceStream for a xlarge screen or a xhdpi resolution
Hi Allm I have an image which I have in form of a stream. I want to create a drawable from this stream so that I can set it as background for my view or ImageView which occupies the whole device screen. I did the below code to achieve the same but facing some issues Drawable.createFromResourceStream(getResources(),val, stream, null); Where val is a typedValue whose density is set to densitydpi retrieved from DisplayMetrics. The issue is when I do the above, the image is not filling/covering the whole area i.e. its not probably getting rescaled to xhdpi. I am trying this with WVGAA800 and a density of 240dpi emulator. I am using android 2.2 to build the application. Any help will be greatly appreciated. Thanks in advance! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Drawable from createFromResourceStream for a xlarge screen or a xhdpi resolution
Hi All, I have an image which I have in form of a stream. I want to create a drawable from this stream so that I can set it as background for my view or ImageView which occupies the whole device screen. I did the below code to achieve the same but facing some issues Drawable.createFromResourceStream(getResources(),val, stream, null); Where val is a typedValue whose density is set to densitydpi retrieved from DisplayMetrics. The issue is when I do the above, the image is not filling/covering the whole area i.e. its not probably getting rescaled to xhdpi. I am trying this with WVGAA800 and a density of 240dpi emulator. I am using android 2.2 to build the application. Any help will be greatly appreciated. Thanks in advance! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Drawable advantage over bitmap for memory in android
This question is linked with the answers in the following question: http://stackoverflow.com/questions/4259851/error-removing-bitmapsandroid/4260269#4260269 Is there any advantage of using Drawable over Bitmap in Android in terms of memory de-allocation ? I was looking at Romain Guy project Shelves and he uses SoftReference for images caches but I'm unable to search where is the code which is de-allocating these Drawables when SoftReference automatically reclaims the memory for Bitmap. As far as I know .recycle() has to be explicitly called on the Bitmap for it to be de-allocated. Thanks -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] drawable resources is stored in RAM at startup?
Hi everyone, Drawable resource is set as background for second layouts (Second activity). My problem is, I get Drawable from resources end set color filter to that, than I set this drawable to layout (First activity). On second activity I don't set color filter but background remain the same. How does an app work with resources, is it cache effect or reference to the same drawable in RAM? Thanks -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] drawable resources is stored in RAM at startup?
You shouldn't modify a Drawable without first calling .mutate() on it (and using the Drawable that is returned, no the original). On Fri, Nov 19, 2010 at 6:39 AM, viktor victor.scherb...@gmail.com wrote: Hi everyone, Drawable resource is set as background for second layouts (Second activity). My problem is, I get Drawable from resources end set color filter to that, than I set this drawable to layout (First activity). On second activity I don't set color filter but background remain the same. How does an app work with resources, is it cache effect or reference to the same drawable in RAM? Thanks -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Drawable resource image size.
Hi, I am writing a GL app and, as such, am only loading drawable resources at the last second (right before they are rendered for the first time). The problem with this is that I need to know the size of the image before I get to the rendering portion of code. Ideally I would like to automatically process the drawables directory and write out the sizes to an xml at build time (from what I can tell no data about the drawables is available before they are loaded except for their resource IDs). Is this possible? i.e. can I extend the android resource build pipeline to automatically generate the correct xml before the xml files are also built? Or has anybody got a better way to achieve what I need? Thanks! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Drawable not maintaining size within an ImageView
Hi, I'm trying to add a drawable to a layout, using an ImageView, but the drawable doesn't maintain its size and is rendered at 1dp x 1dp. I've called ImageView.setAdjustViewBounds as per the android documentation but this doesn't seem to help. The Drawable is only visible when the ImageView's height and width are set and the drawable is then rendered at those dimensions. Here's the code and layout: rect_blue.xml --- ?xml version=1.0 encoding=utf-8? shape xmlns:android=http://schemas.android.com/apk/res/android; android:height=50dp android:width=100dp android:shape=rectangle solid android:color=#00FF / corners android:radius=5dp / /shape FlipView.java (Derived from FrameLayout) --- ImageView drawableContainer = new ImageView(context); drawableContainer.setImageResource(R.drawable.rect_blue); drawableContainer.setAdjustViewBounds(true); this.AddView(drawableContainer); Layout Overview -- RelativeLayout - FrameLayout - ImageView (With drawable set as content) I'm sure I'm doing pretty much exacly the same as the example here: http://developer.android.com/guide/topics/graphics/2d-graphics.html. Could it be because I'm using a FrameLayout that this is not working? Thanks! Andy -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Drawable resource images
Can I have sub-folders to hold my drawable resources. For example can I store an image in, say, 'res/drawable/content/images/myimage.jpg' and then find that resource via a call to: id = context.getResources().getIdentifier(com.mycompany.myprog:drawable/ content/images/myimage, null, null); I have tried this and it doesn't seem to be working (but I may have something wrong). Is it supposed to work, or do all the resources need to be in the root drawable folder? Also, are jpeg files supported and drawable resources? Thanks -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Drawable resource images
John Gaby wrote: Can I have sub-folders to hold my drawable resources. For example can I store an image in, say, 'res/drawable/content/images/myimage.jpg' and then find that resource via a call to: id = context.getResources().getIdentifier(com.mycompany.myprog:drawable/ content/images/myimage, null, null); No, sorry. Also, are jpeg files supported and drawable resources? Yes: http://developer.android.com/guide/appendix/media-formats.html -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _Android Programming Tutorials_ Version 2.0 Available! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Drawable resource XML alias
Does anyone know the syntax for an XML file for a single bitmap drawable resource? What I'm looking to do is alias a drawable in my app. I have need for the same image with 2 different names, and rather than including the image twice in my res/drawable directory, I'd rather alias it (it's fairly large). In other words, instead of: res/drawable/name1.png res/drawable/name2.png I'd like to have: res/drawable/name1.png res/drawable/name2.xml where name2.xml looks SOMETHING like this: ?xml version=1.0 encoding=UTF-8 ? bitmap src=@drawable/name1 / Is this possible? If so, any idea what the syntax should be? I can't find it in the docs, and I've had no luck with trial-and-error. Thanks, String -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Drawable resource XML alias
String wrote: Does anyone know the syntax for an XML file for a single bitmap drawable resource? What I'm looking to do is alias a drawable in my app. I have need for the same image with 2 different names, and rather than including the image twice in my res/drawable directory, I'd rather alias it (it's fairly large). In other words, instead of: res/drawable/name1.png res/drawable/name2.png I'd like to have: res/drawable/name1.png res/drawable/name2.xml where name2.xml looks SOMETHING like this: ?xml version=1.0 encoding=UTF-8 ? bitmap src=@drawable/name1 / Is this possible? If so, any idea what the syntax should be? I can't find it in the docs, and I've had no luck with trial-and-error. http://idunnolol.com/android/drawables.html Your syntax may work just as is. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _Android Programming Tutorials_ Version 2.0 Available! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] drawable-hdpi not appearing in eclipse emulator
Hi there, So I have this game running on Android 1.6, and I put the different density images in their respective folders res/drawable-hdpi/image.png res/drawable-mdpi/image.png res/drawable-ldpi/image.png I made each image a different color so I can tell if it is loading the right image. When I test my program on different density screens it only chooses the mdpi images. It scales them to match the correct dpi but doesn't choose the right folder. It just defaults to mdpi. In the manifest I have, android:normalScreens=true android:anyDensity=false Anyone have a similar problem? I'm sure it is something simple that I am overlooking but I can't figure it out. From what I read on the Android Support Multiple Screens guide is that you should just have to put the different density images in their correct folders and Android will do the rest. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] drawable-hdpi not appearing in eclipse emulator
You told it you don't support densities with android:anyDensity=false. Thus it will run your app as if it is the original density, mdpi. In some cases the framework may be able to actually load the correct density resource and seamlessly use it while you still think you are running in mdpi... but not always, and really, if you are coding your app to support multiple densities, you shouldn't tell Android that you don't support densities. :) On Tue, May 11, 2010 at 12:01 PM, Cameron.M.Johnson cameron.m.john...@gmail.com wrote: Hi there, So I have this game running on Android 1.6, and I put the different density images in their respective folders res/drawable-hdpi/image.png res/drawable-mdpi/image.png res/drawable-ldpi/image.png I made each image a different color so I can tell if it is loading the right image. When I test my program on different density screens it only chooses the mdpi images. It scales them to match the correct dpi but doesn't choose the right folder. It just defaults to mdpi. In the manifest I have, android:normalScreens=true android:anyDensity=false Anyone have a similar problem? I'm sure it is something simple that I am overlooking but I can't figure it out. From what I read on the Android Support Multiple Screens guide is that you should just have to put the different density images in their correct folders and Android will do the rest. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Drawable Setbounds not working
I am trying to scale a drawable at run time depending on the orientation and and handset dimensions. But this does not seem to take effect. This is done on onPreDraw() of textview. It's a textview having text and images. Works fine on the 2.x handsets but does not work on the 1.6 ones. Any ideas on how this can be resolved ? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Drawable issues
Hi, I am trying to resize an image in a textview (set using imagespan). I tried using setbounds but the image is not reflected. OnPreDraw - set the bounds OnDraw - shows the image in some weird place - the updated position isn't shown correctly. Can someone please suggest any other option to resize a drawable ? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Drawable is not drawn after setDrawableByLayerId
Hi, I'm having a problem with displaying a drawable. I have a ImageButton and a LayerDrawable. I set up an array of Drawable that has one Drawable for the background (index 0) and one for the image (index 1). The button would display different background on different states of the button. What I've done is when the button state changes I replace the background Drawable like: elements[0] = background drawable object elements[1] = image drawable object layers = new LayerDrawable(elements); layers.setId(0, 0); layers.setId(1, 1); ... LayerDrawable ld = (LayerDrawable)button.getDrawable(); boolean result = ld.setDrawableByLayerId(0, new backgroundDrawable); ... The problem is the initial old background is gone but the new one is not displayed. What have I done wrong or missed? Thank you! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] drawable, drawable-land, drawable-hdpi, drawable-mdpi, drawable-lpdi
I have a question that I hope someone can help me out with. I have an app that I started in 1.6. It used images that were specific to portrait and landscape layouts. I put these in the corresponding drawable folders, for example: drawable/image01,png drawable-land/image01.png when I created a new project with 2.0 it gave me the following folders. drawable drawable-hdpi drawable-mdpi drawable-lpdi when I look at the documentation around these folders it all seems very straight forward. I assumed that you were able to create the following folders drawable-hdpi-land drawable-mdpi-land drawable-lpdi-land and everything would work as before. The image directory would swap automagically pulling the appropriately laid out image depending on your screen orientation. Unfortunately it does not. The SDK seems to get confused, and if I clean the project, the folders come up as poorly named. Does anybody have any insight as to how this works in 2.0? Any help would be greatly appreciated. Thanks, James -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Drawable
my code is:- Drawabel partlycloud=res.getDrawable(R.drawable.a65_color_31); I have more images like a65_color_31 a66_color_31 a67_color_31 a68_color_31 a69_color_31 a70_color_31 a71_color_31 If user gives input as 67 then my drawable should be Drawabel partlycloud=res.getDrawable(R.drawable.a67_color_31); if it is 70 Drawabel partlycloud=res.getDrawable(R.drawable.a70_color_31); like this i have more than 100 images how can give in simple code with less codes. please reply me.. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Drawable tilemode repat only vertically
Hi! Is there a way to specify that a drawable should only be repeated vertically and then stretched horizontally? At the momemt I use the following which repeates the drawable both in the vertical and horizontal direction: ?xml version=1.0 encoding=utf-8? bitmap xmlns:android=http://schemas.android.com/apk/res/android; android:src=@drawable/wallpaper android:tileMode=repeat /bitmap Best regards, Klaus --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] drawable out of memory (urgent)
Hi all, I'm trying to load 4Mb of png in a parcelable arraylist. When more than 1mb is loaded in my list I take an outofmemory exception. Is there a size limit for an arraylist, for. Drawable loaded in memory, or another. Thanks a lot for your answers. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Drawable cannot draw into Canvas
I want to load an icon from resource and draw over it. But I cannot get it into a canvas. Can anyone please help me with the code below. If I uncomment c.drawColor(), I get blue color as expected. So the problem is on icon.draw(). Drawable icon = getResources().getDrawable(R.drawable.icon2); Bitmap bitmap = Bitmap.createBitmap(icon.getIntrinsicWidth(), icon.getIntrinsicHeight(), Bitmap.Config.ARGB_); Canvas c = new Canvas(bitmap); icon.draw(c); //c.drawColor(Color.BLUE); ImageView iv = (ImageView)findViewById(R.id.icon); iv.setImageBitmap(bitmap); Thanks, Jay --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Drawable or Uri for Notification icon
The Notification API allows to set a drawable resource id for the icon of a notification. This drawable resource id is used to put the icon in the status bar and in the expanded window shade. This is a limitation if the icon images are to be represented by a Drawable or from a content provider at runtime. I propose that the Notification class adds fields (or methods) that would allow to set a Drawable or an Uri for the notification icon. This Drawable or Uri would then be used by the system notification service to put the icon in the status bar and in the expanded window shade. Android team, could you provide your comments? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] @drawable/logo is not showing the icon in Emulator
Hi I am not able to show the icon at the startup time in my emulator This is the code what i have in manifest.xml application android:icon=@drawable/logo and I have logo.png in drawble folder. But still i am not getting that icon it is diaplying simply blank block image. Can any one help me in this --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Drawable doesn't load sometimes
Hi, guys. I load Drawables (jpeg pictures) from URLs the following way: URL urlO = new URL(url); URLConnection urlC = urlO.openConnection(); InputStream is = urlC.getInputStream(); return Drawable.createFromStream(is, url); It's funky that sometimes it returns null and sometimes some incompletely loaded drawable. I see the following errors in the log: 11-11 22:01:41.693: DEBUG/skia(1314): xx failure to skip request 3954 actual 3372 11-11 22:01:41.693: DEBUG/skia(1314): xxx jpeg error 91 Miscellaneous marker 0x%02x, length %u As I understand Drawable is somehow asynchronously loaded. How would you recommend me go around this issue? I use those drawables for example as markers on the map. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Drawable in XML referencing other drawables by state.
I found two interesting drawables in ApiDemos: selector xmlns:android=http://schemas.android.com/apk/res/android; item android:state_pressed=true android:drawable=@drawable/ black_opaque_box / item android:drawable=@drawable/black_box / /selector layer-list xmlns:android=http://schemas.android.com/apk/res/ android item android:drawable=@drawable/progress_circular_background / itemrotate android:pivotX=50% android:pivotY=50% android:fromDegrees=0 android:toDegrees=360 android:drawable=@drawable/progress_particle / /item /layer-list I found no documentation for this kind of drawable. In ItemizedOverlay we can use drawables with state_focused is handled. I tried to pass the following drawable (bubble.xml) selector xmlns:android=http://schemas.android.com/apk/res/android; item android:drawable=@drawable/bubble_normal / item android:state_focused=true android:drawable=@drawable/bubble_focused / /selector Unfortunately, my map always show bubble_normal even if there is a focused item (I checked that). I suppose I have to use another tag than selector but I didn't found in the documentation which tag to use nor all possible tag list. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---