Display display = ((WindowManager) 
getSystemService(WINDOW_SERVICE)).getDefaultDisplay();
int width = display.getWidth();  
int height = display.getHeight();


On Friday, August 10, 2012 4:34:12 PM UTC-5, cellurl wrote:
>
> I have an app that looks fine on an HTC-G1, but is all misaligned on a 
> tablet. 
> Q: What functions should I use to find screen size, so I can get rid 
> of the hard numbers you see below. 
> For example, 347 is 50% in the X direction... 
> Thanks for any leads! 
> -cellurl 
>
>
> public class View extends SurfaceView implements SurfaceHolder.Callback { 
>
>     class Thread extends Thread implements OnJetEventListener {} 
>
>       public Thread(SurfaceHolder surfaceHolder, Context context, 
> Handler handler) {} 
>
>        c = mSurfaceHolder.lockCanvas(null); 
>                     // synchronized (mSurfaceHolder) { 
>                     doDraw(c); 
>         } 
>
>         private void doNeedleAnimation2nd(Canvas canvas) { 
>
>             float px= 347;  //this is the center for R.drawable.needle 
>             float py= 33; 
>             canvas.translate(-110, 245);    //this is the pivot for 
> R.drawable.background_a 
>         } 
>

-- 
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

Reply via email to