当前位置: 首页>>代码示例>>Java>>正文


Java Time.format方法代码示例

本文整理汇总了Java中android.text.format.Time.format方法的典型用法代码示例。如果您正苦于以下问题:Java Time.format方法的具体用法?Java Time.format怎么用?Java Time.format使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.text.format.Time的用法示例。


在下文中一共展示了Time.format方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: formatTime

import android.text.format.Time; //导入方法依赖的package包/类
static public String formatTime(int ms) {
    String res;
    if (ms <= 0) {
        res = EMPTY_STRING;
    } else {
        Time t = new Time();
        t.set(ms);
        t.switchTimezone(Time.TIMEZONE_UTC);
        if (ms >= 3600000) {
            res = t.format(TIME_HOUR);
        } else if (ms < 60000)
            res = t.format(TIME_SECOND);
        else
            res = t.format(TIME_MINUTE);

        if (res.charAt(0) == '0') {
            res = res.substring(1);
        }
    }
    return res;
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:22,代码来源:Browser.java

示例2: updateTime

import android.text.format.Time; //导入方法依赖的package包/类
private void updateTime() {
	// TODO KIO Is this really necessary to creat a calendar?
	// Calendar calendar = Calendar.getInstance();
	// calendar.setTime(mTest.getDate());

	Log.d(TAG_KIO, "Inside updateTime() mDate time is: "
			+ mTest.getDate().getTime());
	Log.d(TAG_KIO, "Inside updateTime() mDate is: " + mTest.getDate());

	Time time = new Time();
	time.set(mTest.getDate().getTime());

	String timeFormat = time.format("%I:%M");
	Log.d(TAG_KIO, "timeFormat is: " + timeFormat);
	mTimeButton.setText(timeFormat);
}
 
开发者ID:publiclab,项目名称:SmART-Form,代码行数:17,代码来源:TestFragment.java

示例3: createNdefMessage

import android.text.format.Time; //导入方法依赖的package包/类
/**
 * Implementation for the CreateNdefMessageCallback interface
 */
@Override
public NdefMessage createNdefMessage(NfcEvent event) {
    Time time = new Time();
    time.setToNow();
    String text = ("Beam me up!\n\n" +
            "Beam Time: " + time.format("%H:%M:%S"));
    NdefMessage msg = new NdefMessage(NdefRecord.createMime(
            "application/com.example.android.beam", text.getBytes())
     /**
      * The Android Application Record (AAR) is commented out. When a device
      * receives a push with an AAR in it, the application specified in the AAR
      * is guaranteed to run. The AAR overrides the tag dispatch system.
      * You can add it back in to guarantee that this
      * activity starts when receiving a beamed message. For now, this code
      * uses the tag dispatch system.
      */
      //,NdefRecord.createApplicationRecord("com.example.android.beam")
    );
    return msg;
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:24,代码来源:Beam.java

示例4: formatTime

import android.text.format.Time; //导入方法依赖的package包/类
public String formatTime(long ms) {
	String res;
	if (ms == 0) {
		res = "";
	} else {
		Time t = new Time();
		t.set(ms);
		t.switchTimezone(Time.TIMEZONE_UTC);
		if (ms >= 3600000) {
			res = t.format("%kh%M'");
		} else if (ms < 60000)
			res = t.format("%S''");
		else
			res = t.format("%M'%S''");

		if (res.charAt(0) == '0') {
			res = res.substring(1);
		}
	}
	return res;
}
 
开发者ID:archos-sa,项目名称:aos-MediaLib,代码行数:22,代码来源:ArtworkFactory.java

示例5: getFile

import android.text.format.Time; //导入方法依赖的package包/类
private File getFile(final String suffix) {
    Time time = new Time();
    time.setToNow();
    audioFilePath = time.format("%Y%m%d%H%M%S");
    return new File(RECORD_WAV_PATH, time.format("%Y%m%d%H%M%S") + "." + suffix);
}
 
开发者ID:timstableford,项目名称:P-BrainAndroid,代码行数:7,代码来源:RecordWavMaster.java


注:本文中的android.text.format.Time.format方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。