Skip to main content
fix spelling and grammar and make Android specific
Source Link
David Rawson
  • 21.2k
  • 9
  • 93
  • 130

object Object not locked by thread before wait in Android app

In my Android app I am trying to execute a task every 5 seconds.

I tried doing something like this:

@Override
public void onCreate() {
   //standard initialization code

    letsChange();           //method name 

    try{
        Waitwait(1000);
    } catch(Exception e) {
        e.printstackstrace();
    }
}

But I get the following error message: java.lang.IllegalMonitorStateException: object not locked by thread before wait()

java.lang.IllegalMonitorStateException: object not locked by thread before wait()

What do I do to stop this?

object not locked by thread before wait

In my Android app I am trying to execute a task every 5 seconds.

I tried doing something like this:

@Override
public void onCreate() {
   //standard initialization code

    letsChange();           //method name
    try{
        Wait(1000);
    }catch(Exception e){
        e.printstackstrace();
    }
}

But I get the following error message: java.lang.IllegalMonitorStateException: object not locked by thread before wait()

What do I do to stop this?

Object not locked by thread before wait in Android app

In my Android app I am trying to execute a task every 5 seconds.

I tried doing something like this:

@Override
public void onCreate() {
   //standard initialization code

    letsChange();           //method name 

    try{
        wait(1000);
    } catch(Exception e) {
        e.printstackstrace();
    }
}

But I get the following error message:

java.lang.IllegalMonitorStateException: object not locked by thread before wait()

What do I do to stop this?

In my androidAndroid app iI am trying to call a method afterexecute a specific time interval. Eg. Aftertask every 5 secsseconds.

So i didI tried doing something like this:

//@Override
public Ivoid amonCreate() writing{
 this code inside//standard onCreateinitialization code

    letsChange();           //method name
    try{
        Wait(1000);
    }catch(Exception e){
        e.printstackstrace();
    }
}

But while running it its showing me thisI get the following error message: object not locked by thread before wait()java.lang.IllegalMonitorStateException: object not locked by thread before wait()

What to do please help me. Thank You So MuchI do to stop this?

In my android app i am trying to call a method after a specific time interval. Eg. After every 5 secs

So i did something like this:

// I am writing this code inside onCreate
letsChange();           //method name
try{
    Wait(1000);
}catch(Exception e){
    e.printstackstrace();
}

But while running it its showing me this error object not locked by thread before wait()

What to do please help me. Thank You So Much

In my Android app I am trying to execute a task every 5 seconds.

I tried doing something like this:

@Override
public void onCreate() {
   //standard initialization code

    letsChange();           //method name
    try{
        Wait(1000);
    }catch(Exception e){
        e.printstackstrace();
    }
}

But I get the following error message: java.lang.IllegalMonitorStateException: object not locked by thread before wait()

What do I do to stop this?

improved formatting
Source Link
Maher Abuthraa
  • 17.7k
  • 12
  • 84
  • 105

In my android app i am trying to call a method after a specific time interval. Eg. After every 5 secs

So i did something like this:

// I am writing this code inside onCreate
 
               letsChange();           //method name
                try{
 
                Wait(1000);
 
                }catch(Exception e){
                 e.printstackstrace();
                }

But while running it its showing me this error object not locked by thread before wait()

What to do please help me. Thank You So Much

In my android app i am trying to call a method after a specific time interval. Eg. After every 5 secs

So i did something like this:

// I am writing this code inside onCreate
 
               letsChange();           //method name
                try{
 
                Wait(1000);
 
                }catch(Exception e){
                 e.printstackstrace();
                }

But while running it its showing me this error object not locked by thread before wait()

What to do please help me. Thank You So Much

In my android app i am trying to call a method after a specific time interval. Eg. After every 5 secs

So i did something like this:

// I am writing this code inside onCreate
letsChange();           //method name
try{
    Wait(1000);
}catch(Exception e){
    e.printstackstrace();
}

But while running it its showing me this error object not locked by thread before wait()

What to do please help me. Thank You So Much

Source Link
g33k
  • 45
  • 1
  • 4
Loading