本文整理汇总了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));
}
示例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);
}
示例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());
}
示例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);
}
示例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);
}
示例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());
}