Android :: Obtaining SurfaceView Dimensions

Jul 6, 2010

I'm trying to develop a little game, with 2D Graphics. I want my "gaming board" to be at a specific position on my screen, so that I can display in-game informations above and below the box. But since there is beginning to be a lot of Android phones out there, I was thinking about getting "dynamic" values so that I can adapt my font size to every device.

My game is not in full screen (but it could be, it's no big deal), but in a window with no title bar.

I'm using an extension of the default SurfaceView class, implementing SurfaceHolder.Callback. I tried writing the following method :

CODE:................

But the values returned are zeroes.

(even if it means changing display strategy) ?

Android :: Obtaining SurfaceView dimensions


Android :: SurfaceView Vs Custom View / SurfaceView Is Slower

Aug 20, 2010

One using a Surfaceview, and the other using a custom view. According to the android SDK development guide, using a surface view is better because you can spawn a separate thread to handle graphics. Th SDK development guide claims that using a custom view with invalidate calls is only good for slower animations, less intense graphics.However, in my simple app, I can clearly see that using a custom view with calls to invalidate seems to render faster.What do you guys know/think about this?My touchEvent code is exactly the same, and my drawing code is exactly the same. The only difference is that one is all in the UI thread, and the other is using a tread to handle the drawing.

View 1 Replies View Related

Android :: Get Dimensions Of ImageView?

Nov 5, 2010

I would like to find the dimensions of an ImageView to use to scale a Bitmap, prior to to calling view.setImageBitmap. ImageView.getWidth and ImageView.getHeight return 0 if no image has been set. (Presumably because the ImageView has not yet been measured?). Is there anyway to determine the dimensions of the ImageView prior to setting the Bitmap?

View 1 Replies View Related

Android :: Get Dimensions Of Image?

May 7, 2010

I have a image in drawable folder and i need to get dimensions of that image.

i tried BitmapFactory,getHeight etc but it is rerunning me null.

View 6 Replies View Related

Android :: Wallpaper - Background Dimensions?

Jan 6, 2010

Which are the default dimension of the Home wallpaper/background for the various Android screen configurations (small, normal and large screens with low, medium and high density)?

Are 9-patch PNG files supported for the wallpaper? Should I be using these instead?

I found a method in API level 5 that gives you the minimum size of the wallpaper, but I would like to support previous versions of Android as well.

View 3 Replies View Related

Android : How To Get Dimensions Of Soft Keyboard?

Jun 18, 2010

My Android app uses a GLSurfaceView so that I can draw to screen directly from native code. As part of the app, I invoke the Android softKeyboard when necessary to receive input. I then feed the input to the native app via JNI. All this works well.. Now, the problem is that I need to know the dimensions of the soft keyboard or any other Input Method windows that are displayed so that I can pan, scroll the native application correctly.

View 4 Replies View Related

Android :: Correct Way To Specify Dimensions In DIP From Java Code?

Nov 24, 2010

I found that it is possible to set dimensions of my interface elements in XML layouts using DIPs as in following fragment : "android:layout_width="10dip" But all Java interface takes integer as arguments and there is no way to specify dimensions in DIPs. What is the correct way to calculate this? I figured that I have to use property density of DisplayMetrics class but is this a correct way ? May I rely on that formula:
pixels * DisplayMetrics.density = dip

View 2 Replies View Related

Android :: Setting The Dimensions Of A Dialog - What Does Fill_parent Mean?

Nov 7, 2010

The Android Developer guidance on Creating a Custom Dialog specifies a layout that starts:

code:........

If I use this code I get a dialog that sits in the centre of the screen with about 40 pixels of the underlying view visible on each side.

What exactly does "fill_parent" mean (for the width and height)?

View 2 Replies View Related

Android :: Scale For Different Screen Resolutions / Dimensions?

Aug 5, 2010

I have a class that extends LinearLayout and handles drawing to the screen. (it is in the early stages) How would I go about determining the dimensions of a screen and resizing the images, etc., that this class is drawing to the screen on the fly before actually drawing them to the screen?

What I'm trying to accomplish is support for devices that have varying screen dimensions and resolutions from the same code base, with each device being scaled properly.

View 7 Replies View Related

Android : Get Screen Dimensions In Main Activity?

Jun 19, 2009

I created some custom elements and I want to programatically place them to the upper right corner (n pixels from the top edge and m pixels from the right edge) therefore I need to get the screen width and screen height and then set position:

int px = screenWidth - m;
int py = screenWidth - n;

Does anyone know how to get screenWidth and screenHeight in the main Activity?

View 3 Replies View Related

Android :: Size A View Based On Its Parent's Dimensions?

Jan 29, 2010

How can I size a view based on the size of its parent layout. For example I have a relativelayout that fills the full screen, and I want a child view, say an imageview, to take up the whole height, and 1/2 the width? I've tried overriding all on onMeasu onLayout onSizeChanged etc and I couldn't get it working....

View 3 Replies View Related

Android :: OpenGL ES Render Textures Of Non Base 2 Dimensions

Sep 18, 2010

Question before I dive deeper into converting my current rendering system to openGL. I heard that textures needed to be in base2 sizes in order to be stored for rendering. Is this true?

My application is very tight on memory, but most of the bitmaps are not a perfect square. Does storing non-base 2 textures waste extra memory?

View 3 Replies View Related

Android :: Re-layout Views In Phone To Reflect New Dimensions?

Nov 24, 2010

I am adding a series of custom views to a LinearLayout. I have overridden the onMeasure method of these custom views, to return the dimensions based on certain parameters. Based on user input, I would like to change these parameters, to change the size of the views. How can I force the LinearLayout to "re-layout" it's children, to reflect the new dimensions?

View 1 Replies View Related

Android :: Design For Droid Apps Ever-changing Screen Dimensions?

Aug 2, 2010

I'm a web designer by nature, accustomed to changing resolutions and font sizes, but I'm unsure how to design for the Android platform without knowledge of screen sizes, especially when the screen rotates from portrait mode to landscape.

Should I just do generic things that tile, or is there a way to design things of static size?

By this, I mean for the GUI and graphics, not element nodes of the XML.

View 1 Replies View Related

Android :: Obtaining Exact SDK Source

Sep 2, 2009

I was hoping someone could give me instructions to obtain the *exact *source code for the current SDK. What I have so far is as discussed here; http://androidforums.com/android-developers/1045-source-code-android- By using commands such as; repo init -u git://android . git . kernel .org/platform/manifest.git -b android-sdk-1.5_r3 jar cvf ../android-src.jar -C core/java . etc. my issue is that the source is still inconsistent, some extra methods are available and some are not. For example, I want to make a progress bar with two sliders (To select a range) but the version of Progress bar I have; http:// android .git.kernel.org/?=platform/frameworks /base.git;a=blob ;.http://android .git.kernel .org/?p=platform/ frameworks /base.git;a=blob;> I cannot mimic (as an initial implementation), despite using the same package and extending View I do not have access to 'mMinWidth' for example. In addition the progress bar uses methods of the class StateList Drawable which are not available in this SDK (e.g. getStateSet(int i)). It's obvious that there's an inconsistency between the source I have and that which was compiled into the android SDK but I don't know why given my GIT repo commands. Can someone link to the version of ProgressBar which was shipped with android-sdk-1.5_r3? Has anyone managed to get the branch which maps directly to this release? This might well be due my inexperience with Git, please let me know if anyone has this set up correctly and I will try again. I seem, in all honesty, to have the head revision still.

View 6 Replies View Related

Android :: Obtaining Name Of Object Reference

Nov 3, 2010

Object getThisObjName= new Object();

I'd like to get the name of an object reference.

Is this possible via reflection in Android?

View 10 Replies View Related

Motorola Droid X :: Way To Get Dimensions Of Icons?

Jul 23, 2010

Wondering if anyone has the stock Droid X launcher icons, they appear to be larger than all the rest and I kind of like then so I might try to use them with LP. Does anyone know what the dimensions of these icons are and where I can get them? I am referring to the icons circled in red below:

View 11 Replies View Related

HTC Incredible :: Dimensions Of Extended Battery?

Apr 19, 2010

Anyone know if the extended batt is thicker...if so how much?

View 7 Replies View Related

Android :: Obtaining Video Frames For Processing

Dec 31, 2009

I am trying to decode and obtain all frames in a video stream, each of which would be processed by a native signal processing engine and re-encoded back to a MPEG4/MP4 file. I noticed that there was a getFrameAt() function in earlier versions of SDK but its not available in v 1.6 on which I am working. As I am fairly new to Android, I would like to know from more experienced people around here as to how I can extract video frames into a buffer for processing.

View 2 Replies View Related

Android :: Obtaining The Selected Index Of A Spinner

Mar 26, 2010

I want to obtain the index of the selected item in a spinner.

I am aware of the method getSelectedItem() which returns the item selected (which might be a String). But i want the index of the selected item.

Something equivalent to the setSelection(index) to set the selected item.

Of course I can get the selected item and compare it against the array of items to obtain the index, but I hope there is a better way of doing this.

View 2 Replies View Related

Android :: Obtaining/calculating Process CPU Usage

May 4, 2009

How can I get/calculate current process CPU usage? ActivityManager provides method that returns a list of all active processes (list of RunningAppProcessInfo), but that class doesn't provide any CPU usage information.

View 10 Replies View Related

Android :: Obtaining Application Usage Data

May 18, 2009

Is there any way to programmatically retrieve data that reports on application usage as shown in the Spare Parts application? I know what calls need to be made, but it seems that they all use internal APIs...is this true?

View 2 Replies View Related

Android :: Obtaining Field Of View Of Camera

May 14, 2009

Is there a method of obtaining the field of view for a phones camera (horizontal and vertical)?

View 2 Replies View Related

Android :: Obtaining A Private Key Through The Keytool For App Release

Nov 24, 2010

I can't find a tutorial online that gives me the step by step process on how to generate a suitable key using the keytool in the JDK.

This: http://developer.android.com/guide/publishing/app-signing.html

Talks about it and gives commands, but it doesn't actually say where and in what folder to key in the commands. I am sure I am missing something easy here, but could anyone guide me to where I need to start with this?

View 1 Replies View Related

Android :: Obtaining Data From Sensors Without Listeners

May 24, 2010

I have following code:

CODE:...........

Code is working but here goes my problem: when I call it from main activity in this way:

CODE:........

Then i can see 10 times result of 'doing sth else!!!' and when loop is over i can see then result from activity. So sensor activity waits for some reason and then when main activity has nothing to do, sensors are doing their job.

of course I have well implemented: onActivityResult(int requestCode, int resultCode, Intent intent)

I want to read sensord data directly, not using listeners, is it possible?

View 1 Replies View Related

Android :: Practice For Obtaining Compass Reading?

Aug 18, 2010

Now that SENSOR_ORIENTATION is deprecated, what's the best practice for obtaining compass reading? The old way was so simple.

View 1 Replies View Related

General :: Android - Obtaining IP Address (WiFi)

Jul 10, 2012

I had to factory reset my router and now when i try to connect my phone to the wifi all i get is "Obtaining IP address".

View 9 Replies View Related

Motorola Droid X : Need Best Dimensions / Resolution For Photo Widget

Jul 17, 2010

What are the best dimensions and resolution for the photo widget? It asks to crop the photo on the phone and it kills the quality and it looks more pixelated when you do.

View 1 Replies View Related

HTC EVO 4G :: Obtaining IP Adress For 4g Orlando

Jul 5, 2010

When I try to connect to 4g it says there is a network available but stays stuck on the 'obtaining ip adress' screen. I am located in Orlando which is one of the upcoming cities for 4g. Does this mean that the antenna is there but not yet strong enough or what?

View 13 Replies View Related

HTC EVO 4G :: 4G Connection - Obtaining IP Address?

Jun 4, 2010

I am right outside Chicago and have yet to be able to connect to 4G. I seems like the Evo is starting to connect to 4G, but then just sits with the message of "Obtaining IP address from Sprint". I have left it in this state for 30 mins, and nothing happens. Does anyone know if this is a fault of the phone, or maybe a lack of coverage?

View 23 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved