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


Java Time.parse3339方法代码示例

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


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

示例1: getExpire

import android.text.format.Time; //导入方法依赖的package包/类
public Date getExpire() {
    if (null != expire) {
        Time time = new Time();
        if (time.parse3339(expire)) {
            return new Date(time.toMillis(true));
        }
    }
    return null;
}
 
开发者ID:uriio,项目名称:uriio-android,代码行数:10,代码来源:ShortUrl.java

示例2: onHandleIntent

import android.text.format.Time; //导入方法依赖的package包/类
@Override
protected void onHandleIntent(Intent intent) {
    Time time = new Time();

    ConnectivityManager cm = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
    NetworkInfo ni = cm.getActiveNetworkInfo();
    if (ni == null || !ni.isConnected()) {
        Log.w(TAG, "Not online, not refreshing.");
        return;
    }

    sendStickyBroadcast(
            new Intent(BROADCAST_ACTION_STATE_CHANGE).putExtra(EXTRA_REFRESHING, true));

    // Don't even inspect the intent, we only do one thing, and that's fetch content.
    ArrayList<ContentProviderOperation> cpo = new ArrayList<ContentProviderOperation>();

    Uri dirUri = ItemsContract.Items.buildDirUri();

    // Delete all items
    cpo.add(ContentProviderOperation.newDelete(dirUri).build());

    try {
        JSONArray array = RemoteEndpointUtil.fetchJsonArray();
        if (array == null) {
            throw new JSONException("Invalid parsed item array" );
        }

        for (int i = 0; i < array.length(); i++) {
            ContentValues values = new ContentValues();
            JSONObject object = array.getJSONObject(i);
            values.put(ItemsContract.Items.SERVER_ID, object.getString("id" ));
            values.put(ItemsContract.Items.AUTHOR, object.getString("author" ));
            values.put(ItemsContract.Items.TITLE, object.getString("title" ));
            values.put(ItemsContract.Items.BODY, object.getString("body" ));
            values.put(ItemsContract.Items.THUMB_URL, object.getString("thumb" ));
            values.put(ItemsContract.Items.PHOTO_URL, object.getString("photo" ));
            values.put(ItemsContract.Items.ASPECT_RATIO, object.getString("aspect_ratio" ));
            time.parse3339(object.getString("published_date"));
            values.put(ItemsContract.Items.PUBLISHED_DATE, time.toMillis(false));
            cpo.add(ContentProviderOperation.newInsert(dirUri).withValues(values).build());
        }

        getContentResolver().applyBatch(ItemsContract.CONTENT_AUTHORITY, cpo);

    } catch (JSONException | RemoteException | OperationApplicationException e) {
        Log.e(TAG, "Error updating content.", e);
    }

    sendStickyBroadcast(
            new Intent(BROADCAST_ACTION_STATE_CHANGE).putExtra(EXTRA_REFRESHING, false));
}
 
开发者ID:rashikaranpuria,项目名称:xyz-reader-2,代码行数:53,代码来源:UpdaterService.java

示例3: parseTime

import android.text.format.Time; //导入方法依赖的package包/类
/**
 * Parse the given string as a RFC 3339 timestamp, returning the value as
 * milliseconds since the epoch.
 */
public static long parseTime(String timestamp) {
    final Time time = new Time();
    time.parse3339(timestamp);
    return time.toMillis(false);
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:10,代码来源:ParserUtils.java

示例4: onHandleIntent

import android.text.format.Time; //导入方法依赖的package包/类
@Override
protected void onHandleIntent(Intent intent) {
    Time time = new Time();

    ConnectivityManager cm = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
    NetworkInfo ni = cm.getActiveNetworkInfo();
    if (ni == null || !ni.isConnected()) {
        Log.w(TAG, "Not online, not refreshing.");
        return;
    }

    sendBroadcast(
            new Intent(BROADCAST_ACTION_STATE_CHANGE).putExtra(EXTRA_REFRESHING, true));

    // Don't even inspect the intent, we only do one thing, and that's fetch content.
    ArrayList<ContentProviderOperation> cpo = new ArrayList<ContentProviderOperation>();

    Uri dirUri = ItemsContract.Items.buildDirUri();

    // Delete all items
    cpo.add(ContentProviderOperation.newDelete(dirUri).build());

    try {
        JSONArray array = RemoteEndpointUtil.fetchJsonArray();
        if (array == null) {
            throw new JSONException("Invalid parsed item array" );
        }

        for (int i = 0; i < array.length(); i++) {
            ContentValues values = new ContentValues();
            JSONObject object = array.getJSONObject(i);
            values.put(ItemsContract.Items.SERVER_ID, object.getString("id" ));
            values.put(ItemsContract.Items.AUTHOR, object.getString("author" ));
            values.put(ItemsContract.Items.TITLE, object.getString("title" ));
            values.put(ItemsContract.Items.BODY, object.getString("body" ));
            values.put(ItemsContract.Items.THUMB_URL, object.getString("thumb" ));
            values.put(ItemsContract.Items.PHOTO_URL, object.getString("photo" ));
            values.put(ItemsContract.Items.ASPECT_RATIO, object.getString("aspect_ratio" ));
            time.parse3339(object.getString("published_date"));
            values.put(ItemsContract.Items.PUBLISHED_DATE, time.toMillis(false));
            cpo.add(ContentProviderOperation.newInsert(dirUri).withValues(values).build());
        }

        getContentResolver().applyBatch(ItemsContract.CONTENT_AUTHORITY, cpo);

    } catch (JSONException | RemoteException | OperationApplicationException e) {
        Log.e(TAG, "Error updating content.", e);
    }

    sendBroadcast(
            new Intent(BROADCAST_ACTION_STATE_CHANGE).putExtra(EXTRA_REFRESHING, false));
}
 
开发者ID:frank-tan,项目名称:XYZReader,代码行数:53,代码来源:UpdaterService.java

示例5: onHandleIntent

import android.text.format.Time; //导入方法依赖的package包/类
@Override
protected void onHandleIntent(Intent intent) {
    Time time = new Time();

    ConnectivityManager cm = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
    NetworkInfo ni = cm.getActiveNetworkInfo();
    if (ni == null || !ni.isConnected()) {
        Log.w(TAG, "Not online, not refreshing.");
        return;
    }

    sendStickyBroadcast(
            new Intent(BROADCAST_ACTION_STATE_CHANGE).putExtra(EXTRA_REFRESHING, true));

    // Don't even inspect the intent, we only do one thing, and that's fetch content.
    ArrayList<ContentProviderOperation> cpo = new ArrayList<ContentProviderOperation>();

    Uri dirUri = ItemsContract.Items.buildDirUri();

    try {
        JSONArray array = RemoteEndpointUtil.fetchJsonArray();
        if (array == null) {
            throw new JSONException("Invalid parsed item array");
        }

        for (int i = 0; i < array.length(); i++) {
            ContentValues values = new ContentValues();
            JSONObject object = array.getJSONObject(i);
            values.put(ItemsContract.Items.SERVER_ID, object.getString("id"));
            values.put(ItemsContract.Items.AUTHOR, object.getString("author"));
            values.put(ItemsContract.Items.TITLE, object.getString("title"));
            values.put(ItemsContract.Items.BODY, object.getString("body"));
            values.put(ItemsContract.Items.THUMB_URL, object.getString("thumb"));
            values.put(ItemsContract.Items.PHOTO_URL, object.getString("photo"));
            values.put(ItemsContract.Items.ASPECT_RATIO, object.getString("aspect_ratio"));
            time.parse3339(object.getString("published_date"));
            values.put(ItemsContract.Items.PUBLISHED_DATE, time.toMillis(false));

            Long id = Long.valueOf(object.getString("id"));
            Cursor cursor = getContentResolver().query(ItemsContract.Items.buildDirUri(),
                    ArticleLoader.Query.PROJECTION, ItemsContract.Items.SERVER_ID + "=" + id,
                    null, null);

            if (cursor == null || !cursor.moveToFirst()) {
                cpo.add(ContentProviderOperation.newInsert(dirUri).withValues(values).build());
            }

            if (cursor != null && !cursor.isClosed()) {
                cursor.close();
            }
        }

        getContentResolver().applyBatch(ItemsContract.CONTENT_AUTHORITY, cpo);

    } catch (JSONException | RemoteException | OperationApplicationException e) {
        Log.e(TAG, "Error updating content.", e);
    }

    sendStickyBroadcast(
            new Intent(BROADCAST_ACTION_STATE_CHANGE).putExtra(EXTRA_REFRESHING, false));
}
 
开发者ID:DmitryMalkovich,项目名称:make-your-app-material,代码行数:62,代码来源:UpdaterService.java


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