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


Java PersistableBundle.putString方法代码示例

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


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

示例1: createShortcutForAndroidN

import android.os.PersistableBundle; //导入方法依赖的package包/类
@RequiresApi(api = Build.VERSION_CODES.N_MR1)
private void createShortcutForAndroidN() {
    Icon icon;
    if (mIsDefaultIcon) {
        icon = Icon.createWithResource(this, R.drawable.ic_node_js_black);
    } else {
        Bitmap bitmap = BitmapTool.drawableToBitmap(mIcon.getDrawable());
        icon = Icon.createWithBitmap(bitmap);
    }
    PersistableBundle extras = new PersistableBundle(1);
    extras.putString(ScriptIntents.EXTRA_KEY_PATH, mScriptFile.getPath());
    ShortcutManager.getInstance(this).addDynamicShortcut(mName.getText(), mScriptFile.getPath(), icon,
            new Intent(this, ShortcutActivity.class)
                    .putExtra(ScriptIntents.EXTRA_KEY_PATH, mScriptFile.getPath())
                    .setAction(Intent.ACTION_MAIN));
}
 
开发者ID:hyb1996,项目名称:Auto.js,代码行数:17,代码来源:ShortcutCreateActivity.java

示例2: requestSync

import android.os.PersistableBundle; //导入方法依赖的package包/类
public static void requestSync(Context context, String inputId, boolean currentProgramOnly) {
    PersistableBundle pBundle = new PersistableBundle();
    pBundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
    pBundle.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
    pBundle.putString(SyncJobService.BUNDLE_KEY_INPUT_ID, inputId);
    pBundle.putBoolean(SyncJobService.BUNDLE_KEY_CURRENT_PROGRAM_ONLY, currentProgramOnly);
    JobInfo.Builder builder = new JobInfo.Builder(REQUEST_SYNC_JOB_ID,
            new ComponentName(context, SyncJobService.class));
    JobInfo jobInfo = builder
            .setExtras(pBundle)
            .setOverrideDeadline(SyncJobService.OVERRIDE_DEADLINE_MILLIS)
            .setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)
            .build();
    scheduleJob(context, jobInfo);
    Intent intent = new Intent(SyncJobService.ACTION_SYNC_STATUS_CHANGED);
    intent.putExtra(SyncJobService.BUNDLE_KEY_INPUT_ID, inputId);
    intent.putExtra(SyncJobService.SYNC_STATUS, SyncJobService.SYNC_STARTED);
    LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
}
 
开发者ID:nejtv,项目名称:androidtv-sample,代码行数:20,代码来源:SyncUtils.java

示例3: scheduleAddWatchNextRequest

import android.os.PersistableBundle; //导入方法依赖的package包/类
public static void scheduleAddWatchNextRequest(Context context, ClipData clipData) {
    JobScheduler scheduler = (JobScheduler) context.getSystemService(JOB_SCHEDULER_SERVICE);

    PersistableBundle bundle = new PersistableBundle();
    bundle.putString(ID_KEY, clipData.getClipId());
    bundle.putString(CONTENT_ID_KEY, clipData.getContentId());
    bundle.putLong(DURATION_KEY, clipData.getDuration());
    bundle.putLong(PROGRESS_KEY, clipData.getProgress());
    bundle.putString(TITLE_KEY, clipData.getTitle());
    bundle.putString(DESCRIPTION_KEY, clipData.getDescription());
    bundle.putString(CARD_IMAGE_URL_KEY, clipData.getCardImageUrl());

    scheduler.schedule(new JobInfo.Builder(1,
            new ComponentName(context, AddWatchNextService.class))
            .setMinimumLatency(0)
            .setExtras(bundle)
            .build());
}
 
开发者ID:googlesamples,项目名称:leanback-homescreen-channels,代码行数:19,代码来源:AddWatchNextService.java

示例4: putParcelable

import android.os.PersistableBundle; //导入方法依赖的package包/类
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public static <T extends Parcelable> void putParcelable(T parcelable, PersistableBundle persistableBundle, String name) {
    if (parcelable == null) {
        return;
    }
    PersistableBundle bundle = new PersistableBundle();
    bundle.putString("class", parcelable.getClass().getCanonicalName());
    bundle.putString("data", Base64.encodeToString(marshallParcelable(parcelable), 0));
    persistableBundle.putPersistableBundle(name, bundle);
}
 
开发者ID:hortonworks,项目名称:nifi-android-s2s,代码行数:11,代码来源:SerializationUtils.java

示例5: setUpPeriodicSync

import android.os.PersistableBundle; //导入方法依赖的package包/类
public static void setUpPeriodicSync(Context context, String inputId) {
    PersistableBundle pBundle = new PersistableBundle();
    pBundle.putString(SyncJobService.BUNDLE_KEY_INPUT_ID, inputId);
    JobInfo.Builder builder = new JobInfo.Builder(PERIODIC_SYNC_JOB_ID,
            new ComponentName(context, SyncJobService.class));
    JobInfo jobInfo = builder
            .setExtras(pBundle)
            .setPeriodic(SyncJobService.FULL_SYNC_FREQUENCY_MILLIS)
            .setPersisted(true)
            .setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)
            .build();
    scheduleJob(context, jobInfo);
}
 
开发者ID:nejtv,项目名称:androidtv-sample,代码行数:14,代码来源:SyncUtils.java

示例6: scheduleDeleteWatchNextRequest

import android.os.PersistableBundle; //导入方法依赖的package包/类
public static void scheduleDeleteWatchNextRequest(Context context, String clipId) {
    JobScheduler scheduler = (JobScheduler) context.getSystemService(JOB_SCHEDULER_SERVICE);

    PersistableBundle bundle = new PersistableBundle();
    bundle.putString(ID_KEY, clipId);

    scheduler.schedule(new JobInfo.Builder(1, new ComponentName(context,
            DeleteWatchNextService.class))
            .setMinimumLatency(0)
            .setExtras(bundle)
            .build());
}
 
开发者ID:googlesamples,项目名称:leanback-homescreen-channels,代码行数:13,代码来源:DeleteWatchNextService.java


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