class main
{
/*
描画する絵を選択する処理
int i = checkInputKey(); //入力されたキー番号を取得
*/
ThreadClass tc = new ThreadClass("tc"); //カレントスレッド名を渡す
tc.setThread(tc); //Thread情報を渡す
tc.setDrawPattern(i); //描画するパターンiを渡す
tc.start(); //Thread起動
}
//スレッド
public class ThreadClass
extends HandlerThread
implements Runnable {
{
super(s);
}
public void run()
{
Looper.prepare();
Handler hi = new Handler(tc.getLooper()); //メインスレッドのルーパー貰う
//※起動してみたら↑で止まる
//tc.getLooper()を外せば止まらずプログラムは走るが、↓のRunが起動せず終了する
public void run () {
//描画処理
}
});
}
public void setThread(ThreadClass t)
{
tc = t;
}
}
Y2xhc3MgbWFpbgp7CiAgLyoKICAgIOaPj+eUu+OBmeOCi+e1teOCkumBuOaKnuOBmeOCi+WHpueQhgogICAgaW50IGkgPSBjaGVja0lucHV0S2V5KCk7CS8v5YWl5Yqb44GV44KM44Gf44Kt44O855Wq5Y+344KS5Y+W5b6XCgogICovCuOAgFRocmVhZENsYXNzIHRjID0gbmV3IFRocmVhZENsYXNzKCJ0YyIpOwkvL+OCq+ODrOODs+ODiOOCueODrOODg+ODieWQjeOCkua4oeOBmQogIHRjLnNldFRocmVhZCh0Yyk7CS8vVGhyZWFk5oOF5aCx44KS5rih44GZCiAgdGMuc2V0RHJhd1BhdHRlcm4oaSk7CS8v5o+P55S744GZ44KL44OR44K/44O844OzaeOCkua4oeOBmQrjgIB0Yy5zdGFydCgpOwkJLy9UaHJlYWTotbfli5UKfQogCi8v44K544Os44OD44OJCnB1YmxpYyBjbGFzcyBUaHJlYWRDbGFzcyBleHRlbmRzIEhhbmRsZXJUaHJlYWQgaW1wbGVtZW50cyBSdW5uYWJsZQp7CiAgVGhyZWFkQ2xhc3MoU3RyaW5nIHMpCiAgewogICAgc3VwZXIocyk7CiAgfQrjgIAK44CAcHVibGljIHZvaWQgcnVuKCkK44CAewogICAgTG9vcGVyLnByZXBhcmUoKTsKICAgIEhhbmRsZXIgaGkgPSBuZXcgSGF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