how to obtain the default font size

by guich » Wed, 16 Mar 2011 01:39:54 GMT


Sponsored Links
 Hi,

I searched the topics and tried some things, but could not achieve
what i need.

I want to obtain the font height in PIXELS used in the text "Silent
mode" of the "Sound & display" option of the Settings application.

In this screen i see lots of font sizes, but i want the biggest size.
I assume that this is the standard size of the font for the device.

Actually, if i could find any "default font size" in pixels i could
compute the other sizes.

What i have is:

1. A class that extends SurfaceView
1.1 A Bitmap that's drawn with my app contents
1.2 A SurfaceHolder
2. A class that extends Activity

I assumed that i could get the info with some structure at the
surfaceChanged, but i checked all methods of all classes and could not
find anything useful.

TIA,

     guich

-- 



Re: how to obtain the default font size

by Brill Pappin » Wed, 16 Mar 2011 03:36:36 GMT


 I'm interested in what responses you get.

I attempted to use text sizes indicated by the OS in one of my keyboards, 
but it turns out that some phones don't report it properly or have a very 
different idea of what the size means than others do. For me the result was 
that on some phones the text would be very tiny.
So far I have not discovered a really reliable way to set a text size.

- Brill Pappin

-- 


Sponsored Links


Re: how to obtain the default font size

by guich » Wed, 16 Mar 2011 21:05:28 GMT


 Its really a shame that this can't be done. I never found a solution,
in any other threads. Boy, i miss Windows Mobile, with their
SystemMetrics api.

guich

-- 



Re: Re: how to obtain the default font size

by Pepijn Van Eeckhoudt » Wed, 16 Mar 2011 21:27:46 GMT


 

Its really a shame that this can't be done. I never found a solution, in any other threads. Boy, i miss Windows Mobile, with their SystemMetrics api.
Have you tried reuse the correct style/theme ( http://developer.android.com/guide/topics/ui/themes.html )? Bit of a kludge, but you could also try creating an instance of the corresponding View and asking that for its text size. (e.g., new TextView().getTextSize()) Pepijn --



Re: how to obtain the default font size

by guich » Wed, 16 Mar 2011 22:06:07 GMT


 Pepijn,

Many thanks. That simple line solved the issue.

Got the following results:

Htc Magic: 14
Motorola Spice: 11
Motorola Milestone: 21

So, from this i can achieve the results i need.

All the best

    guich

-- 



Re: how to obtain the default font size

by guich » Wed, 16 Mar 2011 22:07:39 GMT


 Many thanks, it worked!

-- 



Other Threads

1. call interceptor application

Hello friends,

Right now I'm developing an application for intercepting an incoming
call..
My query is that I want to handle calls from my own application i.e.
call answering as well as call rejection.
I need your help that how actually I would be able to do this task..?
Pls Help..
Thanks in advance...

-- 

2. Free File Dialog for Android

Hi, i made a file dialog for android, it's not included in the
standard api. I'm sure it will be useful. It's simple enough to use.
Just wanna share it with you guys  
https://code.google.com/p/android-file-dialog/

-- 

3. How I could to reaches at $ 10.00 AdSence account balance, if I don't want use AdSence service, need it just for connection AdSence account with Google checkout for selling my app

4. On FC, where does the problem report go?

5. Gestures

6. Samsung Galaxy Tab

7. How do I do monkey test for 24 hours?