アクティビティの開始時にイメージ ビュー イメージを継続的に変更します。スレッドを使用せずにそれは可能ですか?少なくとも、スレッドを適切に使用する方法と、どのように開始する必要があるかを教えてください。お願いします。、
それは、Android ゲームのようなもぐらたたき用です。
ランダムなテキストの単純な表示を試みましたが、うまくいきませんでした。
public class NewGame extends Activity {
gameThread gameOn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.newgame);
hView = (TextView) findViewById(R.id.HammersText);
gameOn = new gameThread();
gameOn.start();
}
}
public class gameThread extends Thread
{
NewGame gameOn;
public void run() {
super.run();
Random ramhole = new Random();
int hole = ramhole.nextInt(8);
Random ramletter = new Random();
int letter = ramletter.nextInt(26);
gameOn = new NewGame();
gameOn.hView.setText("Hole = "+hole+"Letter = "+letter);
}
}
これについて私を助けてください。