Android :: Difference Between SurfaceView And View?

Aug 7, 2009

When is it necessary, or better to use a SurfaceView instead of a View?

Android :: Difference between SurfaceView and View?


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 : What Is Difference Between View.ondraw / View.dispatchdraw?

Mar 27, 2009

Specifically I want to know if one can give me better performance. I want to draw the whole surface myself as I am scrolling a large bitmap. Basically I am trying to figure out how things like ListView / GridView do smooth scrolling (see thumbnails in picture viewer app) and writing custom views (even using surface views) seem to be flicker a lot.

View 2 Replies View Related

Android :: Drawing View On My Own SurfaceView / Canvas

Sep 9, 2010

I am using SurfaceView to draw my game on the screen of the phone. Basically now I want to be able to draw Android Views on my View, such as a Button or ListView. I am simlpy getting a Canvas and then I draw on that... does anybody know how to draw AndroidViews (Button, ListView.) on my Canvas?

View 2 Replies View Related

Android :: Setup Background Of SurfaceView Just Like A 2D View?

Mar 27, 2009

Code...

Is there a way to set the background of the SurfaceView just like a 2D view?

View 4 Replies View Related

Android :: Adding GestureOverlayView To My SurfaceView Class - How To Add To View Hierarchy

Jul 30, 2010

I was informed in a later answer that I have to add the GestureOverlayView I create in code to my view hierarchy, and I am not 100% how to do that. Below is the original question for completeness.

I want my game to be able to recognize gestures. I have this nice SurfaceView class that I do an onDraw to draw my sprites, and I have a thread thats running it to call the onDraw etc .

This all works great.

I am trying to add the GestureOverlayView to this and it just isn't working. Finally hacked to where it doesn't crash but this is what i have

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

The onGesturePerformed is never called. Their example has the GestureOverlay in the xml, I am not using that, my activity is simple:

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

So I am at a bit of a loss of the missing piece of information here, it doesn't call the onGesturePerformed and the nice pretty yellow "you are drawing a gesture" never shows up.

View 1 Replies View Related

Android :: Adding View Extending From SurfaceView To Layout Gives Blank Screen

Jun 5, 2010

I'm very new to Android programming, so this is probably something pretty basic. I just have an xml layout with a few buttons. I'm trying to follow the model given by the JetBoy demo, so I'm adding a view to the layout which extends SurfaceView. When this new view is put in my xml layout, I just get a blank screen.

Here's the XML layout if it helps. The gameview element is what causes the screen to be blank

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

View 2 Replies View Related

Android :: Difference Between View Margin And Padding?

Oct 30, 2009

Difference between View margin and padding , mPadding and mUserPadding?

View 2 Replies View Related

Android :: Difference Between View's And Bitmap's Canvas?

Mar 6, 2009

Can anyone explain me the difference between View's Canvas and Bitmaps Canvas

View 2 Replies View Related

Android :: Android View Or SurfaceView?

Jul 30, 2010

Ive been trying to make a scrollable/zoomable app and everything has gone great except for drawing bitmaps. It is a very large image (6656 by 4096) that i have split into tiles. There is a rectangle array that the bitmaps are drawn to, and it detects what rectangle is in the top left corner so it can draw the bitmaps that will cover the user's viewable screen. My problem is this all lags when the app has to load the bitmaps into memory; Once they are loaded it isnt an issue. I started with 512 by 512 tiles, then went down to 128 by 128. although it helped, there still is some noticeable lag. I have been looking into surfaceView and wanted your opinions if i should stick with View, or use surfaceView to solve my lag.

View 1 Replies View Related

Android :: Switch To SurfaceView

Mar 25, 2009

Im creating a simple game using a SurfaceView for drawing the Graphics. It works fine, but now I tried to add a title screen, which is (for now) only a LinearLayout and a Start-button, specified in XML. However, when I click this button and try to switch to my SurfaceView (By doing setContentView(R.layout.game), the screen turns black. But if I do setContentView(R.layout.game) immediatly in my Activity.onCreate it works. But not if I start with my Title-screen and then try to switch

View 3 Replies View Related

Android :: SurfaceView On G1 - Crashes

Apr 30, 2009

I am finally testing my application on a G1 and even though it works fine on the emulator, it crashes on the G1

It crashes when it does:

CODE:.........

And the view is defined like this:

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

View 3 Replies View Related

Android :: 2 Mediaplayer Using One Surfaceview

Jun 16, 2009

I want to play 2 videos one after one minimizing delay between each video. so I created 2 mediaplayer, one playing the current video and the other preparing to play the following video.

The 1st video is played correctely but I couldn't get the video track of the second video. only sound without any error.

This is my source code : (note that here, I am using files on sdcard but the application will use files on a web server. that's why I need to prepare the second video while the 1st is playing)

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

View 5 Replies View Related

Android :: OnActivityResult Fc When Using SurfaceView?

Sep 4, 2010

My app fc when activity that's using SurfaceView as content view calls startActivityForResult(...) and activity that has been started calls finish()

This does not happen if I change content view to something else than SurfaceView.

This would be the requested logcat:

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

View 1 Replies View Related

Android : Put GLSurfaceview On Top On A SurfaceView

Dec 16, 2009

Look at this: http://nhenze.net/?p=172

They show that it is possible to put an GLSurfaceview on top on a SurfaceView. I hope it would be useful.

View 2 Replies View Related

Android :: How To Exit Activity Using SurfaceView

May 18, 2010

When exiting the activity in a thread in a SurfaceView. This log appears in this situation:.............

View 2 Replies View Related

Android :: SurfaceView Fast Enough For Emulation

Sep 11, 2010

For years now I've maintained a Tandy Color Computer Emulator applet on my home page. With the purchase of an Incredible I decided to do a port. Getting it going in Android didn't take long but I'm really surprised how slow it runs. You can literally see the pixels painting. I know there are other successful Android emulators so I must be doing something wrong.

My approach was to use a SurfaceView for rendering. There's a separate thread that runs a virtual 6809 CPU. Whenever that thread updates the emulated video memory, it calls SurfaceHolder.lockCanvas() with a Rect describing the part of the screen requiring a repaint. Then it calls the gfx routines with the resulting Canvas...this is where I did a repaint() in AWT/Swing. The gfx routines are smart enough to just render what's in the clipRect. Perhaps I'm still stuck in AWT but I can't think of any way to make this thing run at an acceptable speed. I tried to coalesce the gfx calls but that didn't work either. Any thoughts?

View 1 Replies View Related

Android :: SurfaceView Transparent Through Its Parent

Feb 11, 2009

I have a SurfaceView that is covering a portion of its parent, a RelativeLayout. I have a background image covering the full RelativeLayout area, and this is my Activity's main layout.

I would like to have the SurfaceView be transparent so that I can see through to the background image on its parent RelativeLayout. I have tried the approach shown in the API Demos example TranslucentGLSurfaceViewActivity, but this succeeds in making the transparency go all the way through my Activity to my desktop!

I'm using the "style/Theme.Translucent" theme on my activity, and setting this on my SurfaceView: mySurfaceView.getHolder().setFormat(PixelFormat.RGBA_8888);

The transparency to the desktop it kinda cool, but not what I'm trying to do! Is it possible to make a SurfaceView transparent only through to its parent?

View 2 Replies View Related

Android :: Difficulty Resuming SurfaceView

Apr 24, 2009

I am stuck.My main activity creates and starts a SurfaceView.My app needs to access a listview via the options menu to change properties of the items shown in the view.Two strange things occur:

1.) When I scroll the listview quickly, the list sometimes gets farklempt.Words overlap each other.

2.) When I select the item and the app returns to the main activity, the thread is no longer alive.

If someone out there can offer help I will post the code.This will take a little effort.My code is loosely based upon LunarLander and the GLSurfaceView examples.If there is a good example (more recent example) someone can point me to, that would be boss.

View 8 Replies View Related

Android :: Regaining Focus Using SurfaceView

Mar 23, 2009

I'm currently getting to grips with Android, playing around with the Lunar Lander sample. I've found that if you navigate away from the app (eg, hit the call button) it will destroy the underlying surface (calling surfaceDestroyed). Navigating back (which will trigger onWindowVisibilityChanged) the app will crash, as it will try to draw to the surface without recreating it. Is there some code I can put in onWindowVisibilityChanged (or anywhere else) that will regenerate the SurfaceView's underlying surface and resume execution nicely? It feels like this should be a simple function call but I can't find anything in the API docs.

View 2 Replies View Related

Android :: Processing Events In SurfaceView

Jun 10, 2009

I am creating a custom Widget which extends SurfaceView and I am planning to use it for camera preview.In the main activity I tried to implement some event listeners but can't catch any event.If I press a button the LogCat outputs "Continuing to wait for key to be dispatched" line.Does anyone know how to implement event listeners in main activity using SurfaceView classes?

View 3 Replies View Related

Android :: Use SurfaceView Properly , Nothing Is Drawn

May 31, 2009

I had it working with a normal View but that is to slow. I was told to use SurfaceView but can't figure out how to use OnKey with it and if I should use onDraw or draw? And how do I pass stuff to draw? does it happen automatically? code...

View 3 Replies View Related

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

View 1 Replies View Related

Android :: Animating Drawables From Within SurfaceView

May 19, 2009

I am using a SurfaceView, and wish to animate Drawables. All the animation tutorials I have seen concern using an ImageView, which as I understand is not a sensible approach from within a SurfaceView. Does anyone have any suggestions for doing frame-by-frame animation within a SurfaceView? Can it be done with openGL?

View 4 Replies View Related

Android :: Resolution Independence In SurfaceView

Jan 16, 2010

I am currently starting a game engine in Android, first forray onto the platform and have the basics in place however i am unsure of the best way to approach resolution independence when using SurfaceView to draw graphics.

Looking for pointers as to how to keep the game / sprites etc all looking the same independent of the screen, obviously it wouldn't be efficient to scale all the sprites every frame or store many variations for differing resolutions

View 3 Replies View Related

Android :: Update SurfaceView On-the-fly With New Elements

Aug 5, 2010

I have a database filled with records in the following format: . What I want my application to do is select records from an external database, and display those records on the phone screen using a SurfaceView.

Currently, I have an Activity, and a Service responsible for the record-gathering portion of the application. The Activity passes an intent to the Service, and the Service responds by returning the records that need to be displayed. The records are stored in my program as instances of the Data class, and merely have the screen-coordinates of where the element should be drawn in the View (I am just drawing a circle for every record in the DB).

For the sake of brevity, I won't include the service but I will include a skeleton of the Activity class and the Data that I wish to display.

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

The problem that I am having pertains to the SurfaceView. I realize that many people are going to suggest that I use just a regular View, but my application involves a lot of elements, so a SurfaceView would be much more suitable for my needs. Below is a skeleton of my SurfaceView class that contains a nested class to manage the threads.

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

The problem that I'm having is that once I make the initial call to the Panel class, I'm going to be getting new records from the service, and consequently, my Info Map data-structure is going to get updated. However, my Panel class just gets stuck in a loop and never receives any new Data objects. All examples of SurfaceViews I've found have involved updating them methods within the SurfaceView class itself (e.g. touching the screen and creating a new image, etc.) Sadly, I'm stumped on this particular problem. Is there a better approach for designing my Activity/SurfaceView interaction? Is an additional View required?

View 1 Replies View Related

Android :: Compositing MapView And SurfaceView

Oct 13, 2010

I have an application with a SurfaceView and a MapView. They are displayed in a single view, like so:

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

Note the MapView comes before the SurfaceView. Because of this, the MapView is drawn "under" the SurfaceView, and all that I see is a black background, with the things that I draw on the SurfaceView showing. If I swap the order, and put SurfaceView first in the file and MapView second, the MapView is drawn, with none of the SurfaceView showing.

According to the SurfaceView Javadoc:

The surface is Z ordered so that it is behind the window holding its SurfaceView; the SurfaceView punches a hole in its window to allow its surface to be displayed. The view hierarchy will take care of correctly compositing with the Surface any siblings of the SurfaceView that would normally appear on top of it.

To me, this means that I should be able to put the SurfaceView first in the file, and have it "punch through" the MapView and display what it has. But, as it is, they seem to be two views, and only one is visible at a time.

After thought: I tried setting the background to #00000000 so that the alpha of the background would be zero (i.e. transparent), but it doesn't have any effect.

View 2 Replies View Related

Android :: Open A AlertDialog In SurfaceView?

Aug 5, 2009

I'm work a game, when game over, I want to open a AlertDialog in the Surfaceview.

How can I open a AlertDialog in SurfaceView??

View 2 Replies View Related

Android :: Draw Text Using SurfaceView?

Nov 6, 2009

I want to write a graphics app using SurfaceView.

Basically my requirement is to draw some text frequently according to some time.

Is it possible to do this? can any one please provide me some source code which draws the text using SurfaceView.

View 2 Replies View Related

Android : How To Make A SurfaceView Always Horizontal?

May 1, 2010

I'm using SurfaceView to draw some stuff using canvas. The problem is that I want to show everything horizontally by default and keep it that way regardless the position of the device. I'm not using any layout XML file to show the SurfaceView; instead I just have a class that extends SurfaceView and I do setContentView(new Panel(this)).

View 1 Replies View Related







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