Ive been trying to make my program register a bunch of android listeners for the phones sensors, wait for 2 seconds to allow them to collect data, then unregister the listeners. However, every time i run the code, it simply throws out an error and continues. What could i be doing wrong?
try {
waitThread(2000);
wait();
}catch (Exception exception){
Log.e("Error", "Could not wait1");
}
==================
public void waitThread(int millis){
new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(millis);
notifyAll();
}catch (Exception exception){
Log.e("Error", "Could not wait");
}
}
});
}