Code example for ProgressBar

Methods: getMaxgetProgressincrementProgressBy

1
timer.scheduleAtFixedRate(new TimerTask() {
			public void run() { 
				// have the timer schedule the progress bar to update at a fixed 
				// interval. 
				progressBar.incrementProgressBy(progressBar.getMax() / 15);
				// If time runs out, return to main menu 
				if (progressBar.getProgress() == progressBar.getMax()) {
					flag = true;
					finish();
				} 
				// if a communications interrupt is received, cancel the timer 
				// and handle the communication 
			} 
		}, 0, 1000); 
	} 
 
	@Override 
	public NdefMessage createNdefMessage(NfcEvent event) {
 
		Log.d("MainActivity", "in createNdefMessage");