Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MainMenuActivity extends AppCompatActivity {
- int width;
- int height;
- MainView mainView;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- DisplayMetrics displayMetrics = new DisplayMetrics();
- getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
- height = displayMetrics.heightPixels;
- width = displayMetrics.widthPixels;
- mainView = new MainView(this, height, width);
- setContentView(mainView);
- Thread thread = new Thread(){
- @Override
- public void run() {
- try {
- while (!isInterrupted()) {
- Thread.sleep(1000);
- runOnUiThread(new Runnable() {
- @Override
- public void run() {
- mainView.updateBird(new Canvas());
- }
- });
- }
- } catch (InterruptedException e) {
- Log.e("MainActivity", "Thread Run Exception");
- }
- }
- };
- thread.start();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement