android chronometer example
Create an application that will display toast(Message) on specific interval of time
File Name : E8Activity.java
package bsr.exa;
import android.app.Activity;
import android.os.Bundle;
import android.widget.Chronometer;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.Chronometer.OnChronometerTickListener;
public class E8Activity extends Activity {
/**
* @author Bipin S Rupadiya , www.BipinRupadiya.blogspot.com
*
* 8) Create an application that will display toast(Message) on specific interval of time
*
**/
Chronometer timer;
int i=0;
int Duretion=10;
TextView txt;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
timer=(Chronometer)findViewById(R.id.chronometer1);
txt=(TextView)findViewById(R.id.txt);
timer.start();
timer.setOnChronometerTickListener(new OnChronometerTickListener() {
@Override
public void onChronometerTick(Chronometer arg0) {
// TODO Auto-generated method stubicon.png
txt.setText("Next Message will display after [ "+(Duretion-(i+1))+" ] seconds ");
i++;
if(i>=Duretion)
{
Toast.makeText(E8Activity.this, "Message "+(i/10), 10000).show();
Duretion+=10;
}
}
});
}
}
Labels:
Android,
Mobile Computing
Subjects
- WordPress
- Mobile Computing-4649303 Practical Solution
- Android Programming New Syllabus Theory
- PHP LAMP Question Bank
- PHP LAMP Theory
- Step by Step Android Example
- Android Practical
- Android Theory
- Android Question Bank
- Networking FON Practical
- Networking FON Theory
- OS Practical
- OS Theory
- HTML
- JavaScript
- J2EE WTAD Theory
- J2EE WTAD Question Bank
- J2EE WTAD Quick Guide
- J2EE WTAD GTU Papers
- J2EE WTAD Practical
- Python
- JAVA Theory
- JAVA Practical
- MIS
Categories
- Android (55)
- c (11)
- Configure Tomcat7 (2)
- CSS (3)
- Decryption (16)
- Difference (1)
- Encryption (16)
- Error Detection and Correction Techniques (3)
- FON (27)
- Framing Technic (2)
- install Tomcat (2)
- J2EE (29)
- JAVA (13)
- JavaScript (19)
- linux (8)
- OS (17)
- PHP (11)
- Protocol (3)
- SERVER SOCKET PROGRAMING (7)
- Servlet (13)
- shell script (33)
- unix (22)
- WTAD (34)
Blog Archive
-
▼
2012
(79)
-
▼
September
(22)
- Chapter 7, Memory Management
- Chapter 6, Concurrency: Deadlock and Starvation
- Chapter 5, Concurrency: Mutual Exclusion and Sync...
- Chapter 4, Threads, SMP, and Micro kernels
- Chapter 3, Process Description and Control
- Chapter 2, Operating System Overview
- Chapter 1, Computer System Overview
- menu in android tutorial
- android animation example
- android chronometer example
- spinner in android example
- listview in android
- implicit intent in android example
- addTextChangedListener in Android example
- Be a Freelances and earn $$$$
- View SQLite Database
- Write a shell script to delete zero sized files fr...
- Android Intent Example
- Hello World in Android
- SQLite Android Tutorial
- Happy Teachers' Day
- Thank you GOD
-
▼
September
(22)
Total Pageviews
© BipinRupadiya.com. Powered by Blogger.