Android :: Ending Thread Safely
Sep 28, 2010I've found lots of great tutorial on starting a thread, however what's the best way to close a thread that's using a SurfaceView in a game loop and set a new view? Could you provide some sample code?

I've found lots of great tutorial on starting a thread, however what's the best way to close a thread that's using a SurfaceView in a game loop and set a new view? Could you provide some sample code?
Can any one tell me , how to stop thread safely ? Can any one help me how to stop or cancel this thread safely ? Code...
View 2 Replies View RelatedCan anyone tell me where can I see the active process and current process. I think we can see in the DDMS --> Devices.But when see the process list, when I launch a application it showing that applications process in the list. after finishing that application also it showing it process in the process list.So how can see only the current active prcocess (Foregroud,Background..etc). I want to see only the current process which running on the device/emulator.One more thing. when I hold on the Home button for long time, It is showing a list. What that list means. whether that list is For the forgrund running apps or active apps or that is a History.
View 2 Replies View Relatedso the phone does the great thing of recognizing when you're using the phone on a call but if you hold the phone with you shoulder or just not right against your face it activates the screen and you hang up on people. does anyone know how (or if) you can turn that function off so that if you want to activate the screen during a call you have to press a button or physically activate the screen?
View 2 Replies View RelatedOn Wed, Sep 1, 2010 at 1:19 PM, siva <sivaraj.r...@gmail.com> wrote: > I have a singleton in an activity. When I end my application (like > pressing back button), and start it again after some time, the > singleton is not recreated, but is holding previous state. Singleton > is not destroyed if the application is destroyed?
View 4 Replies View RelatedI tried to make an Android program where I can call a single number by clicking button. Works fine but as I end calling, the emulator shows call log. Instead of this I would that my program returns to the screen where is that calling button I made.
View 4 Replies View RelatedHow can I implement a run() method of thread if I create a Thread Global?
I mean If I create a Thread Globally then can I implement its run() method {" public void run()"} anywhere in my Application?
In the run() method I have to write the code to perform some action.
IF I can do it then please can anyone show me briefly how to do it particularly.
I am writing an application in which i need to handle messages between the main thread(the deafult UI related thread) and the user created Gamethread.
The requirement is like this.
An activity(say "Activity_X") is setting the view by "setContentView(some "View_Y")". In "Activity_X" i have implemeted "onCreateOptionsMenu()" and "onOptionsItemSelected()" fucntions for creating menus & a switch case for action to be taken on selecting those menus.Menu has items like "resume/pause/zoom/" .
All action to be take on selecting these menus are implemented in "View_Y" in a separate Gamethread by extending "Thread" class.
So whenever a menu is selected in "Activity_X" i need to send a message to "View_Y". And on receiving this ,a particular action/method should be called in View_Y(GameThread).
How can i achieve this using Handlers?Is there any other way of doing this? Please do share with me some code snippets for these.
I am using commitva z71 category phone. (motorola quench xt3 xt502).
I had been using cyanogenmod roms on it. presently i have CM 7.1 EAV 7.2. The roms usually came with ADW launcher as default. But one problem I have been facing is that some times my phone does not respond to press of any button, not even power button after ending a call. The screen however goes off and does not light up.
I have to either remove the battery, replace it and restart or I have to make a call to my phone from another phone. When I give a missed call, the phone gets activated. But when I press Menu button, it brings up the keyboard instead of Menu.
This problem has been persisting whichever version of CM Rom I have been using.
The problem aggravates when I use Go Launcher as my default launcher by using Launcher Switcher. When I use ADW as default lanucher but have Go Launcher also on my phone, sometimes the defaults are cleared and I am asked to choose the launcher to finish the task of closing phone app.
Initially, I thought this was the problem of default phone app. So I tried dialer one from play store, but to no avail.
Is there a way to delete the ADW launcher that comes with the custom ROM?
I have a separate thread running to get data from the internet. After that, I would like to update the ListView in the main thread by calling adapter.notifyDataSetChanged(). But it does not work. Any workaround for that?
View 1 Replies View RelatedI want to do the drawing in another thread to speed up the game(it is way to slow right now). I was told to do this but don't quite understand why that would speed things up. Is it GameView that should implement Runnable? Should I make the thread sleep when not drawing? where should I start the thread? package com.android.WWS;
import android.app.Activity; import android.content.Context; import android.graphics.*; import android.os.Bundle; import android.view.SurfaceView; import android.view.KeyEvent; import android.view.View; import android.view.View.OnKeyListener; import java.lang.Runnable; import java.lang.Thread;...................
My phone started doing some weird force closes and just not acting right, so I am trying to do a nand restore. I have done these in the past with no problem, but it is currently restoring and has made about 25 lines of dots in the restore.Normally it will only do 5 or 6 lines of dots before the restore is complete; is this still normal.The screen is getting close to 2/3s covered in dots at this point and it's starting to worry me that it will never end.Should I pull the battery or is that not a good idea while its restoring. Thanks for any advice you may have I'm really stumped on this one.
View 2 Replies View RelatedSo my beloved Incredible has met it's maker thanks to a 10'+ fall from a ladder when I went to answer a call (stupid move, I know). Click image below for larger view.I went in to VZW, made a claim to Asurion and used one of my available upgrades on another line to get a Samsung Fascinate. I must say, the SAMOLED screen doesn't disappoint. The 4" screen size is the sweet spot for sure. The Incredible is better out of the box with Sense, but the Fascinate is better after a few add ons like Launcher Pro, Beautiful widgets and Handcent (which can all be used on the inc, I know).I'll decide if I'm going to keep the Fascinate or the the Inc in a few weeks I guess. (I'll sell the other)
View 24 Replies View RelatedAfter I end a call and press home a white screen with htc in green letters pops up and then a grey "loading" box for about 10-15 seconds.
View 6 Replies View RelatedMy app targets 1.5, and runs fine on my phone (1.6), but to support droid, I need the package android.telephony.cdma from 2.0. Targeting 2.0 excludes the current devices running my app (including my own G1), but as it is now, I can't support the Droid.
View 8 Replies View RelatedCall me a newbie, but does Android store any critical data on the SD card? Just did a factory reset on my Sprint Hero in preparation for giving the phone to a family member, & I'd like to give them the phone with a clean slate on the SD card as well as the phone. How Can I safely format SD card?
View 1 Replies View RelatedI need to suspend/resume a thread from another thread in the same process. I tried to look into thread apis,but I couldn't figured out a way to achieve this.Can anyone pls point me some references to look or give a tip to do this.
View 2 Replies View Relatedi noticed that ever since i rooted and using froyo 2.2 ( BB) i am unable to end certain apps, to be specific apps market and internet explorer. i used advance task killer manager, and other task killing apps and they just wont end. i mean its not a big deal, but it gets annoying that everytime i open the browser it brings me back to the page i was last on and not my homepage, or when i launch the market place, im left at the last app i was looking at instead of the main page. was froyo designed like this? cause i know it wasnt like this before i was rooted.
View 3 Replies View RelatedI just recently bought a windshield mount for my Vibrant.It is hooked up landscape style with my car charger and a AUX cable connected to it. When I try to make a call, it stays on the calling screen for like 2 seconds then ends the call. This keeps happening no matter how many bars I have.
View 2 Replies View RelatedMy Hero has just started making a beep through the main speaker when ending a call - I don't remember it doing this before - is this normal and is there a setting to disable it?
View 2 Replies View RelatedDoes the screen always wake back up when you finish a call and take the phone away from your head? Therefore you can press end call quickly on the screen.Reason I ask is that I had a Touch Diamond with a power on off button at the top and having to press that and then press end call on the screen was a real pain.
View 5 Replies View RelatedNo matter what I do I cannot get around the boot loop.First I was trying to flash the CM Remix ROM, which ended in a boot loop.I then tried just JRummy's ROM, ended it boot loop.I wiped data, cache and factory restored.Tried flashing CM Remix again, boot loop.Wiped again.Tried flashing a 1ghz kernel, boot loop.Where do I go to wipe system, boot, etc.? I'm starting to lose hope here.
View 19 Replies View RelatedI know that we can safely write to /data/data/app_package... however, can the application also create folders and maybe access other folders as well, such as system? I could easily create an application to test that, but what i really want to know if the official Android approach to this issue. I don't want to assume something that will be changed in the future.
View 4 Replies View RelatedDoes anyone know how to do this correctly? I can't find any examples & the API documentation is pretty hard to follow.I am guessing I need to use the KeyGuardManager and PowerManager... but can't figure out how to bring my activity up past the keyguard and re-enable the keyguard so my activity doesn't let someone get past the lock when my activity awakens.
View 9 Replies View RelatedWhen the user press the home key, the onPause method is called. At this time, the application is supposed to save its state so it can be properly recovered later.
However, and if the state is taking too much time? For example, issuing a closeAllNetworkConnections that was waiting a feedback from the server, or just if the amount of information we're writting to disk is a lot of info... what would happen?
In my tests, i'm getting from 300-500 ms of time until the process is killed.
Is there a safer place to put a "save everything and quit" code so that it can safely save everything before a "kill the activity" task is issued?
I'm working on an application that requires non-serializable objects to be passed between Activities. The following page suggests using a HashMap of WeakReferences to accomplish this:
http://developer.android.com/guide/appendix/faq/framework.html
Is this solution safe? I know Activities are completely destroyed and recreated when the screen orientation changes. Couldn't those weakly referenced objects get GCed in the split second when the screen is rotated, since they wouldn't be referenced elsewhere at that point?
Does anyone know how to delete certain texts from a thread in an easy manner instead of having to delete a whole thread??
View 7 Replies View RelatedBoth my x10 phones have problems ending calls..sometimes you have to push end call a few times and people say they can still hear me when the call as ended...have to be careful i dont say anything nasty about anyone straight after calls ..
View 1 Replies View RelatedMy phone is acting really strange. It turns itself off and then on again and again in this cycle as if the power button is always being pressed.
I can sometimes get into my recovery (CWM) but when I try to go deeper into the menu. I get kicked back to the main screen as if im pressing the power button to go "back" until the phone gets completely turned off again.
I noticed something too. When I pull out the battery and put it back on. The phone turns itself on without me even pressing the power button. Then the cycle continues again.
Could this be software, ROM, recovery, partition related or does this sound something hardware related?
The Android doc says "Like activities and the other components, services run in the main thread of the application process." Is the main thread here the same thing as UI thread?
View 3 Replies View Related