[android-developers] Wait and notify
Hello All,
Here is my code:
if(a == b)){
synchronized (tempWifi) { //tempWifi is an object of
a class with data members only
tempWifi.essid = result.SSID;
tempWifi.freq = result.frequency;
tempWifi.level = result.level;
tempWifi.notify();
Toast.makeText(getBaseContext(), "Notified",
Toast.LENGTH_SHORT).show();
}
}// if condition
// I start the thread at the beginning of the program like this:
/*
Thread thread = new Thread(new vho());
thread.start();
*/
// My Thread
Looper.prepare();
handler.post(new Runnable() {
public void run(){
synchronized (tempWifi) {
try {
Toast.makeText(getBaseContext(), "Going to wait",
Toast.LENGTH_SHORT).show();
tempWifi.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}//sync
Toast.makeText(getBaseContext(), "finished wait",
Toast.LENGTH_SHORT).show();
The wait is never been notified. I get force close after few minutes.
--
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