You could always use floatToIntBits/intBitsToFloat. But keep in mind that the resources are actually char data anyway, and you might as well just use parseFloat on a String (though then you have to catch NumberFormatException).
On Dec 23, 1:33 am, Zsolt Vasvari <[email protected]> wrote: > Thanks, Dianne. I am now just retrieving an int from 0 - 100 and > divide it by 100 and set it as the weight. It works fine, but it's > just extra code and I am lazy person, which is why I asked. :) > > On a related question: > > I am defining the width of my pop-up window as 500dp, this fits nicely > into my HDPI screen on my Nexus One (480x800), but the same 500dp on > an MDPI device (320x480) is wider than the screen and I need to set > the width to 460dp. I would have thought using DIP as the unit of > measure would deal with this. > > Thanks, > Tom > > On Dec 23, 9:41 am, Dianne Hackborn <[email protected]> wrote: > > > Oh also you can just do a percentage dimension ("50%") and retrieve it with > > a base value of 1 or 100 as desired. > > > On Wed, Dec 22, 2010 at 5:40 PM, Dianne Hackborn <[email protected]>wrote: > > > > You can use them as attributes, but unfortunately right now there is no > > > way > > > to get them as direct resources. > > > > Well you can probably do it by being tricky -- use <item> to define a raw > > > resource, and Resources.getValue() to retrieve its value. > > > > (One reason why this doesn't exist is if it made entries in R. for float > > > values it would create code that can't compile since "float" is a > > > keyboard. > > > :p I solved that with ints by calling them integers, and booleans by > > > calling them bools, but we never really needed floats so I never tried to > > > come up with something to call them.) > > > > On Wed, Dec 22, 2010 at 5:04 PM, Zsolt Vasvari <[email protected]> wrote: > > > >> Am I missing something or there is no mechanism to define a float > > >> value as a resource? > > > >> I am trying to have a locale dependent weight added to some of my > > >> buttons. Right now, as a workaround, I am defining the weight as an > > >> Integer and then divide and manualy set it. But why would there be > > >> such a seemingly arbitrary decision made as not to allow floats but > > >> allow ints? > > > >> -- > > >> You received this message because you are subscribed to the Google > > >> Groups "Android Developers" group. > > >> To post to this group, send email to [email protected] > > >> To unsubscribe from this group, send email to > > >> [email protected]<android-developers%2bunsubs[email protected]> > > >> For more options, visit this group at > > >>http://groups.google.com/group/android-developers?hl=en > > > > -- > > > Dianne Hackborn > > > Android framework engineer > > > [email protected] > > > > 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. > > > -- > > Dianne Hackborn > > Android framework engineer > > [email protected] > > > 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.- Hide quoted text - > > > - Show quoted text - -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] 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

