Re: [android-developers] Usage of DisplayMetrics

2012-07-22 Thread Dianne Hackborn
On Sun, Jul 22, 2012 at 5:21 AM, Jim Graham wrote: > That's probably what I'm not clear on What is "everything else" > in this case? If display.getWidth and display.getHeight report that > my tablet's display size is 1280x752 (which, I just discovered, is NOT > what Settings-->About Tablet-

Re: [android-developers] Usage of DisplayMetrics

2012-07-22 Thread Mark Murphy
On Sun, Jul 22, 2012 at 8:21 AM, Jim Graham wrote: > That's probably what I'm not clear on What is "everything else" > in this case? It doesn't matter. Put your SurfaceView in your layout, then calculate your preview size based upon the SurfaceView's size. > I see what this is all about now

Re: [android-developers] Usage of DisplayMetrics

2012-07-22 Thread Jim Graham
On Sun, Jul 22, 2012 at 07:55:59AM -0400, Mark Murphy wrote: > On Sun, Jul 22, 2012 at 7:46 AM, RichardC > wrote: > > How about View width and height instead of Display? > > Precisely. It matters not a whit how big the display is. What matters > is how big the preview SurfaceView can be, after ta

Re: [android-developers] Usage of DisplayMetrics

2012-07-22 Thread Mark Murphy
On Sun, Jul 22, 2012 at 7:46 AM, RichardC wrote: > How about View width and height instead of Display? Precisely. It matters not a whit how big the display is. What matters is how big the preview SurfaceView can be, after taking everything else into account. >> So, correct me if I'm wrong, but t

Re: [android-developers] Usage of DisplayMetrics

2012-07-22 Thread RichardC
How about View width and height instead of Display? On Sunday, July 22, 2012 12:31:21 PM UTC+1, Spooky wrote: > > On Sun, Jul 22, 2012 at 12:06:30AM -0700, Dianne Hackborn wrote: > > > Do you have a specific use case where you think they are the right way > to > > go? > > I use them for determ

Re: [android-developers] Usage of DisplayMetrics

2012-07-22 Thread Jim Graham
On Sun, Jul 22, 2012 at 12:06:30AM -0700, Dianne Hackborn wrote: > Do you have a specific use case where you think they are the right way to > go? I use them for determining the maximum preview size for the camera preview. Whether that's the right way to go or not, I can't say, but it works nice

Re: [android-developers] Usage of DisplayMetrics

2012-07-22 Thread Dianne Hackborn
On Sat, Jul 21, 2012 at 8:02 PM, Jim Graham wrote: > I'm not sure I understand Are you saying that display.getWidth and > display.getHeight don't return valid numbers? Or did I miss something? > I am saying that I don't recommend using them, and I have no good strong use cases for them.

Re: [android-developers] Usage of DisplayMetrics

2012-07-21 Thread Agus
You missed something which is that : "use cases" are different than "how to use". On Sat, Jul 21, 2012 at 8:02 PM, Jim Graham wrote: > On Sat, Jul 21, 2012 at 09:57:34AM -0700, Dianne Hackborn wrote: > > Not sure what you are answering...? That is not a use case, that is just > > retrieving th

Re: [android-developers] Usage of DisplayMetrics

2012-07-21 Thread Jim Graham
On Sat, Jul 21, 2012 at 09:57:34AM -0700, Dianne Hackborn wrote: > Not sure what you are answering...? That is not a use case, that is just > retrieving the values. Which, again, I recommend not using for anything. I'm not sure I understand Are you saying that display.getWidth and display.g

Re: [android-developers] Usage of DisplayMetrics

2012-07-21 Thread Dianne Hackborn
Not sure what you are answering...? That is not a use case, that is just retrieving the values. Which, again, I recommend not using for anything. On Fri, Jul 20, 2012 at 12:10 PM, bob wrote: > Or like so: > > Display display = > ((WindowManager).getSystemService(Context.WINDOW_SERVICE)).getDef

Re: [android-developers] Usage of DisplayMetrics

2012-07-21 Thread Jim Graham
On Fri, Jul 20, 2012 at 12:10:04PM -0700, bob wrote: > float width = display.getWidth(); > float height = display.getHeight(); Correction: display.getWidth() and display.getHeight() both return int, not float. Later, --jim -- THE SCORE: ME: 2 CANCER: 0 73 DE N5IAL (/4)MiSTie #4

Re: [android-developers] Usage of DisplayMetrics

2012-07-20 Thread bob
Or like so: Display display = ((WindowManager).getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); float width = display.getWidth(); float height = display.getHeight(); On Friday, July 20, 2012 1:06:36 PM UTC-5, Dianne Hackborn wrote: > > I recommend never using them. The real corre

Re: [android-developers] Usage of DisplayMetrics

2012-07-20 Thread Dianne Hackborn
I recommend never using them. The real correct size will be given to you through the view hierarchy. On Thu, Jul 19, 2012 at 7:32 PM, Agus wrote: > What are the uses cases in which width and height values of DisplayMetrics > used ? > > Is it just for games ? > > -- > You received this message b

[android-developers] Usage of DisplayMetrics

2012-07-19 Thread Agus
What are the uses cases in which width and height values of DisplayMetrics used ? Is it just for games ? -- 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 unsubscrib