Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@codeforfun-jp
Created June 7, 2021 09:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codeforfun-jp/01c148aad1fdc6c3eeb377dadf4b1720 to your computer and use it in GitHub Desktop.
Save codeforfun-jp/01c148aad1fdc6c3eeb377dadf4b1720 to your computer and use it in GitHub Desktop.
CTB 4-1
private float boxY;
// Handler & Timer
private Handler handler = new Handler();
private Timer timer = new Timer();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// ------------
// --- 省略 ---
// ------------
boxY = 500.0f;
timer.schedule(new TimerTask() {
@Override
public void run() {
handler.post(new Runnable() {
@Override
public void run() {
changePos();
}
});
}
}, 0, 20);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment