- #1
Darkmisc
- 220
- 31
Hi everyone
Could someone show my the correct way to use a recursive runnable? The example I have involves the invokeLater method from SwingUtilities.
I tried using it as a template while removing reference to the invokeLater method. The program loads, but nothing happens when I click the button.
The following lines are highlighted in Logat
Could someone show my the correct way to use a recursive runnable? The example I have involves the invokeLater method from SwingUtilities.
Recursive runnable with invokeLater:
public void mousePressed( MouseEvent e )
{
Runnable runnable = new Runnable( )
{
public void run( )
{
SwingUtilities.invokeLater( new Runnable( )
{
public void run( )
{
button.setText( String.valueOf( counter++ ) );
}
} );
}
};
future = executor.scheduleAtFixedRate( runnable, 0, 200, TimeUnit.MILLISECONDS );
}
code with my modifications:
Runnable mRunnable = new Runnable( )
{
public void run( )
{
new Runnable( )
{
public void run( )
{
n++;
myText.setText( String.valueOf( n ) );
}
} ;
}
};
The following lines are highlighted in Logat
Logcat:
2022-12-09 08:48:26.632 31195-31195/? E/le.clickcounte: Unknown bits set in runtime_flags: 0x8000
2022-12-09 08:48:27.744 31195-31227/com.example.clickcounter W/Gralloc3: mapper 3.x is not supported
2022-12-09 08:48:27.684 31195-31227/com.example.clickcounter W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
2022-12-09 08:48:27.433 31195-31195/com.example.clickcounter W/le.clickcounte: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed)
2022-12-09 08:48:27.433 31195-31195/com.example.clickcounter W/le.clickcounte: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWin2022-12-09 08:48:27.228 31195-31195/com.example.clickcounter W/RenderThread: type=1400 audit(0.0:168): avc: denied { write } for name="property_service" dev="tmpfs" ino=8445 scontext=u:r:untrusted_app:s0:c136,c256,c512,c768 tcontext=u:object_r:property_socket:s0 tclass=sock_file permissive=0
2022-12-09 08:48:27.236 31195-31229/com.example.clickcounter W/libc: Unable to set property "qemu.gles" to "1": connection failed; errno=13 (Permission denied)
Thanks
Last edited by a moderator: