Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Button button = (Button) findViewById(R.id.button1);
- final EditText editText = (EditText) findViewById(R.id.editText1);
- button.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- final Timer timer = new Timer();
- timer.scheduleAtFixedRate(new TimerTask() {
- @Override
- public void run() {
- Calendar c = Calendar.getInstance();
- int seconds = c.get(Calendar.SECOND);
- final String time = String.valueOf(seconds);
- runOnUiThread(new Runnable() {
- @Override
- public void run() {
- editText.setText(time);
- if (time.equals("10")) {
- Uri gmmIntentUri = Uri.parse("geo:0,0?q=restaurants");
- Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
- mapIntent.setPackage("com.google.android.apps.maps");
- startActivity(mapIntent);
- timer.cancel();
- }
- }
- });
- }
- }, 0, 1000);
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement