fork download
  1. class main
  2. {
  3. /*
  4.   描画する絵を選択する処理
  5.   int i = checkInputKey(); //入力されたキー番号を取得
  6.  
  7.   */
  8.  ThreadClass tc = new ThreadClass("tc"); //カレントスレッド名を渡す
  9. tc.setDrawPattern(i); //描画するパターンiを渡す
  10.  tc.start(); //Thread起動
  11. }
  12.  
  13. //スレッド
  14. public class ThreadClass extends HandlerThread implements Runnable
  15. {
  16. ThreadClass(String s)
  17. {
  18. super(s);
  19. }
  20.  
  21.  public void run()
  22.  {
  23. println("test1");
  24. super.run(); // ←こいつがいるとここで止まる
  25. //Looper.prepare();
  26. println("test2");
  27. Handler hi = new Handler(this.getLooper());
  28. //※起動してみたら↑で止まる
  29. //tc.getLooper()を外せば止まらずプログラムは走るが、↓のRunが起動せず終了する
  30.   //Looper.getMainLooper() だと正常に描画されるが、描画中main部分が動作不能となる
  31. //Looper.myLooper() だと、動作はするがhi.postのrun()が起動せず終わってしまう
  32. println("test3");
  33.   hi.post(new Runnable() {
  34.    public void run () {
  35. println("test4");
  36.     //描画処理
  37.    }
  38.   });
  39.  }
  40.  
  41. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:8: illegal character: \12288
?ThreadClass tc = new ThreadClass("tc");      //????????????
^
Main.java:8: ';' expected
?ThreadClass tc = new ThreadClass("tc");      //????????????
 ^
Main.java:8: <identifier> expected
?ThreadClass tc = new ThreadClass("tc");      //????????????
               ^
Main.java:9: <identifier> expected
  tc.setDrawPattern(i); //????????i???
                   ^
Main.java:9: <identifier> expected
  tc.setDrawPattern(i); //????????i???
                     ^
Main.java:10: illegal character: \12288
?tc.start();          //Thread??
^
Main.java:10: ';' expected
?tc.start();          //Thread??
 ^
Main.java:10: illegal start of type
?tc.start();          //Thread??
   ^
Main.java:20: illegal character: \12288
?
^
Main.java:21: illegal character: \12288
?public void run()
^
Main.java:22: illegal character: \12288
?{
^
Main.java:30: illegal character: \12288
??//Looper.getMainLooper() ???????????????main??????????
^
Main.java:30: illegal character: \12288
??//Looper.getMainLooper() ???????????????main??????????
 ^
Main.java:32: ';' expected
    println("test3");
           ^
Main.java:33: illegal character: \12288
??hi.post(new Runnable() {
^
Main.java:33: illegal character: \12288
??hi.post(new Runnable() {
 ^
Main.java:33: ';' expected
??hi.post(new Runnable() {
    ^
Main.java:34: illegal character: \12288
???public void run () {
^
Main.java:34: illegal character: \12288
???public void run () {
 ^
Main.java:34: illegal character: \12288
???public void run () {
  ^
Main.java:34: <identifier> expected
???public void run () {
   ^
Main.java:34: ';' expected
???public void run () {
         ^
Main.java:34: invalid method declaration; return type required
???public void run () {
               ^
Main.java:36: illegal character: \12288
????//????
^
Main.java:36: illegal character: \12288
????//????
 ^
Main.java:36: illegal character: \12288
????//????
  ^
Main.java:36: illegal character: \12288
????//????
   ^
Main.java:37: illegal character: \12288
???}
^
Main.java:37: illegal character: \12288
???}
 ^
Main.java:37: illegal character: \12288
???}
  ^
Main.java:38: illegal character: \12288
??});
^
Main.java:38: illegal character: \12288
??});
 ^
Main.java:39: illegal character: \12288
?}
^
33 errors
stdout
Standard output is empty