I want to print date and in android. Once I run it for first time its getting correct time and date. But When I install in phone and run it its not getting correct. Its giving only same result when I have install it. my code is here:
package com.datePrint;
import java.util.Calendar;
import java.util.GregorianCalendar;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class DatePrint extends Activity {
/** Called when the activity is first created. */
static Calendar cal = new GregorianCalendar();
static int hour = cal.get(Calendar.HOUR);
static int minute = cal.get(Calendar.MINUTE);
static int second = cal.get(Calendar.SECOND);
static int year = cal.get(Calendar.YEAR);
static int month = cal.get(Calendar.MONTH)+1;
static int day = cal.get(Calendar.DATE);
static String date = day+"_"+month+"_"+year+"_";
static String Current_Time = date+ hour + "_" + minute + "_" + second;
public static String OUTPUT_FILE = "/sdcard/"+Current_Time+".mp4";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
tv.setText(Current_Time);
setContentView(tv);
}
}
can anybody help me to solve this problem thanks in advance