Back to project page Android-FactsGame.
The source code is released under:
Apache License
If you think the Android project Android-FactsGame listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package ie.iamshanedoyle.factsgame.activities; /*w w w .ja v a 2 s . co m*/ import android.app.Activity; import android.app.Fragment; import android.os.Bundle; import android.os.Handler; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import ie.iamshanedoyle.factsgame.R; import ie.iamshanedoyle.factsgame.views.CountdownTimerView; public class GameActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_game); if (savedInstanceState == null) { getFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()) .commit(); } } /** * A placeholder fragment containing a simple view. */ public class PlaceholderFragment extends Fragment { CountdownTimerView countdownTimerView; public PlaceholderFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_game, container, false); } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); countdownTimerView = (CountdownTimerView) getView().findViewById(R.id.countdown_timer_view); new Thread() { int i = 99; @Override public void run() { try { while (i-- >= 0) { Thread.sleep(1000); runOnUiThread(new Runnable() { @Override public void run() { countdownTimerView.incrementProgress(Integer.toString(i)); } }); } } catch (InterruptedException e) { } } }.start(); } } }