-1

I am working on Android application. Suppose a clock that show going time. Now I want to add real time that is like a clock.

 protected void onCreate(Bundle bd) {
    if (MyDebug.LOG) {
        Log.d(TAG, "onCreate");
    }
    long time_s = System.currentTimeMillis();
    super.onCreate(bd);
     this.preferences = PreferenceManager.getDefaultSharedPreferences(this);

    setContentView(R.layout.main_activity);
    }
  }
Harry
  • 27
  • 1
  • 5

1 Answers1

-1

If you want only current time with AM/PM then use following:

String current_time = (String) DateFormat.format("hh:mm aaa", Calendar.getInstance().getTime());