Note that there are some explanatory texts on larger screens.

plurals
  1. POIs there any problem with this code?
    primarykey
    data
    text
    <p>It produce the stopped unexpectedly problem when I push the search button.</p> <pre><code>public class beautiful extends Activity { ImageView radar; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); this.requestWindowFeature(Window.FEATURE_NO_TITLE); this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.beautiful); radar = (ImageView) findViewById(R.id.radar); Button search = (Button) findViewById(R.id.magnifier); ImageView text = (ImageView) findViewById(R.id.text); MediaPlayer siren = MediaPlayer.create(this, R.raw.siren); search.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Thread counter = new Thread(new Runnable(){ @Override public void run() { // TODO Auto-generated method stub try{ Thread.sleep(2000); radar.setImageResource(R.drawable.radar_new_full); Thread.sleep(3000); radar.setImageResource(R.drawable.radar_new_50); Thread.sleep(2000); radar.setImageResource(R.drawable.radar_new_found); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally{ } } }); counter.start(); } }); } </code></pre> <p>Here are the LogCat warnings:</p> <p>07-07 17:36:17.298: WARN/dalvikvm(274): threadid=15: thread exiting with uncaught exception (group=0x4001b188) 07-07 17:36:17.306: ERROR/AndroidRuntime(274): Uncaught handler: thread Thread-8 exiting due to uncaught exception 07-07 17:36:17.306: ERROR/AndroidRuntime(274): android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. 07-07 17:36:17.306: ERROR/AndroidRuntime(274): at android.view.ViewRoot.checkThread(ViewRoot.java:2683) 07-07 17:36:17.306: ERROR/AndroidRuntime(274): at android.view.ViewRoot.requestLayout(ViewRoot.java:557) 07-07 17:36:17.306: ERROR/AndroidRuntime(274): at android.view.View.requestLayout(View.java:7918) 07-07 17:36:17.306: ERROR/AndroidRuntime(274): at android.view.View.requestLayout(View.java:7918) 07-07 17:36:17.306: ERROR/AndroidRuntime(274): at android.view.View.requestLayout(View.java:7918) 07-07 17:36:17.306: ERROR/AndroidRuntime(274): at android.view.View.requestLayout(View.java:7918) 07-07 17:36:17.306: ERROR/AndroidRuntime(274): at android.widget.ImageView.setImageResource(ImageView.java:271) 07-07 17:36:17.306: ERROR/AndroidRuntime(274): at example.beautiful$1$1.run(beautiful.java:46) 07-07 17:36:17.306: ERROR/AndroidRuntime(274): at java.lang.Thread.run(Thread.java:1096)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload