Friday, October 22, 2010

[android-developers] Problem With Thread !

I use thic Code in a Class Of type Service :

class A extends Service {

@Override
public IBinder onBind(Intent intent) {
// TODO Auto-generated method stub
Log.v("AppointmentFinderService"," OnBind the Binder ");
return mBinder;
}
@Override
public void onCreate() {

Context context = getBaseContext();

}
@Override
public void onDestroy() {
// TODO Auto-generated method stub
super.onDestroy();
serviceHandler.removeCallbacks(myTask);
serviceHandler = null;
/** Destroy the Thread */
myTask.destroy();
}
@Override
public void onStart(Intent intent, int startId) {
// TODO Auto-generated method stub
super.onStart(intent, startId);
myTask = new Task();
serviceHandler = new Handler();
serviceHandler.postDelayed(myTask, delayMillis);
}

class Task extends Thread{

@Override
public void run() {

try {

sleep(timeToSleep);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();

}
}


}
The Service Work in Right mode but the other activity of application
don't respond to command ...from the sleep command add !!

Someone have an Idea of problem with Thread process, the sleep method
intact the Application main core i think !!!


Thanks in Advance !!

--
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 unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate