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

Android :: How to exit Activity using SurfaceView


Android : Set Result_ok When Activity Exit

Feb 6, 2009

How to set RESULT_OK when activity exit? I am launching list activity from main activity using startActivityForResult, after doing work with list activity; i exit from it from it using "finish()" but it doesn't propagate RESULT_OK to main activity in onActivityResult(), what should I do , so that listact should return RESULT_OK.

View 2 Replies View Related

Android :: How To Animate Activity Entrance And Exit?

Jan 11, 2010

How to animate activity entrance and exit? And activity relaunch after onNewIntent()?I used android:theme in the manifest file but it didn't work for me.

View 2 Replies View Related

Android :: Can't Destroy GLSurfaceView For Exit Activity

Dec 2, 2009

what puzzle me so much is that i can't destroy a GLSurfaceView while i don't want to exit the activity.
the fact is when i destroy a GLSurfaceView which had show in the screen (that means it has binded to the activity's SurfaceHolder), the activity exits without any prompting. Perhaps ,the Context which provided in the Construction of GLSurfaceView joins the two things together. so my conclusion is that a GLSurfaceView can only be destroyed when exit the activity. is there anyway to destroy a GLSurfaceView without exit activity? is there someone can provide a clue?

View 2 Replies View Related

Android : Activity Finish - X System Exit

Jan 21, 2010

I've been using System.exit to quit the application. Is Activity.finish a better approach? What would be the differences?

View 6 Replies View Related

Android : Program On Application - Not Activity - Exit

Jul 22, 2009

I have requirement that needs to save data to a file. During multiple Activitiy screens, I add different data to a list and finally when user is not using the app (means if user exits app by pressing "home" button or "call" button), just before exiting that app, i want to save that data of the list to a file.

coding before exiting activity screen is simple - by calling onDestory () method, but here I want not one activity but the application exit.

So my question is How do I write a code that will be executed just before application exits ? I tried created one class extends Application, and then I override onTerminate() method, but it's not get called when I exit ( pressing home button on device)

View 2 Replies View Related

Android :: Put Camera Preview Inside A Surfaceview In An Activity Xml Gui

Aug 27, 2009

I just got my camera preview working for my app, but it is not appearing where I want it to appear, and I'm not sure how to get it there. Instead of using the entire screen for the preview, I would like to put it inside a surfaceview in an activity xml gui. What do I need to change? Here is my code:

public class TakePic extends Activity {

SurfaceView camSurface;

Preview camPreview;

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

requestWindowFeature(Window.FEATURE_NO_TITLE);//hide window title

camPreview = new Preview(this); //create preview

setContentView(R.layout.takepic);

setContentView(camPreview); //set preview as activity content

camSurface = (SurfaceView) findViewById(R.id.camsurface); }

View 5 Replies View Related

Android :: SurfaceView - Does Not Show The Activity In Grey Background

Jul 27, 2009

1)Which is better for developing a game.

a)Using XML layouts

b)Using Custom layouts with Surface view

2) while making a custom view using Surface view... do we need to have a secondary thread to implement the surfaceholder.callback()......

My code below does not show the activity in grey background as i have coded... do i need to use the unlockcanvas and all ,,but i havent used the secondary thread

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

View 2 Replies View Related

Android :: Translucent Activity Not Calling OnStop On Exit

Dec 3, 2009

I'm having this strange issue where upon exiting a subactivity that is translucent (android:theme="@android: style/Theme.Translucent" ) the onStop() method doesn't appear to be called. have a TimerTask that runs and is supposed to be terminated when the subactivity ends in the onStop() method, but I'm instead left with an orphaned thread running in the background. It go particularly bad when I ran the subactivity several times. When I revert to no theme, the onStop() method is called and the activity behaves properly. Is there something I missed about how Translucent activities'lifecycles differ from standard activities?

View 4 Replies View Related

Android :: Exit Current Activity To Homescreen (without Using Home Button)?

May 3, 2010

What I am trying to do is emulating the "Home" button which takes one back to Android's homescreen. So here is what causes me problems: I have 3 launcher activities. The first one (which is connected to the homescreen icon) is just a (password protected) configuration activity. It will not be used by the user (just admin) One of the other 2 (both accessed via an app widget) is a questionnaire app. I'm allowing to jump back between questions via the Back button or a GUI back button as well. When the questionnaire is finished I sum up the answers given and provide a "Finish" button which should take the user back to the home screen.

For the questionnaire app I use a single activity (called ItemActivity) which calls itself (is that recursion as well when using intents?) to jump from one question to another:

Questionnaire.serializeToXML();
Intent i = new Intent().setClass(c, ItemActivity.class);
if(Questionnaire.instance.getCurrentItemNo() == Questionnaire.instance.getAmountOfItems()) {
Questionnaire.instance.setCompleted(true);
} else Questionnaire.instance.nextItem();
startActivity(i);

The final screen shows something like "Thank you for participating" as well as the formerly described button which should take one back to the homescreen. But I don't really get how to exit the Activity properly. I've e.g. used this.finish(); but this strangely brings up the "Thank you" screen again. So how can I just exit by jumping back to the homescreen?

View 2 Replies View Related

Android : Child Activity Exit By Unexpected Exception - OnActivityResult - Is Not Called

Jun 23, 2010

I have faced with issue about startActivityForResult() and onActivityResult(). If child activity started by the startActivityForResult() exit by unexpected exception the onActivityResult() is not called and I have no any ideas how can I handle this to get application working in a fail-safe manner ?

When my code runs child activity with startActivityForResult() it awaits until onActivityResult() will be invoked to get working further, but onActivityResult() is not calling and my code is "hang- up" (logically).

So the question is how can I handle all possible ways the child activity is finished (normally and by unexpected exception) to get fail-safe code ?

I have check the documentation for this issue but have found nothing relating issue.

View 4 Replies View Related

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 :: Android Surfaceview Is No Longer Visible After Back From Other Activity

Apr 4, 2010

i use surfaceview for camera preview. it works fine, but has one problem when i start other activity (by clicking something) and then back from that activity. after that, surfaceview is no longer visible. (but onclicklistener is working)but when i occur surfacecreated/destoryed by visible/invisible surfaceview in single activity, it works very good.

View 1 Replies View Related

Android :: Android - Show Dialog To Confirm User Before Exit Activity?

Feb 13, 2010

I've been trying to show a "Do you want to exit?", type dialog when user attempts to exit an activity. However can't find the appropriate API hooks. Activity.onUserLeaveHint() initially looked promising, but I can't find a way to stop the activity finishing.

View 2 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 :: 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 :: Difference Between SurfaceView And View?

Aug 7, 2009

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

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







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