本文整理汇总了Java中android.os.PersistableBundle类的典型用法代码示例。如果您正苦于以下问题:Java PersistableBundle类的具体用法?Java PersistableBundle怎么用?Java PersistableBundle使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PersistableBundle类属于android.os包,在下文中一共展示了PersistableBundle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: 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());
}
示例3: onCreate
import android.os.PersistableBundle; //导入依赖的package包/类
@Override
public void onCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) {
super.onCreate(savedInstanceState, persistentState);
setContentView(R.layout.fragment_about);
webView = findViewById(R.id.web_view);
webView.setNetworkAvailable(false);
webView.setWebViewClient(new WebViewClient(){
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url){
if(url.startsWith("http")){
depth++;
return false;
} else {
url = url.replace("file:///android_asset/","");
loadAsset(url);
return true;
}
}
});
loadAsset("file:///android_asset/about.html");
}
示例4: onCreate
import android.os.PersistableBundle; //导入依赖的package包/类
@ReplaceMethod
public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
if (!com_rakuten_tech_mobile_perf_onCreate_tracking) {
com_rakuten_tech_mobile_perf_onCreate_tracking = true;
int id = Tracker.startMethod(this, "onCreate");
try {
onCreate(savedInstanceState, persistentState);
} finally {
Tracker.endMethod(id);
com_rakuten_tech_mobile_perf_onCreate_tracking = false;
}
} else {
onCreate(savedInstanceState, persistentState);
}
}
示例5: onSaveInstanceState
import android.os.PersistableBundle; //导入依赖的package包/类
@Override
public void onSaveInstanceState(Bundle outState, PersistableBundle outPersistentState) {
/*
To maintain activity state across reboots the system saves and restore critical information for
all tasks and their activities. Information known by the system includes the activity stack order,
each task’s thumbnails and each activity’s and task's Intents. For Information that cannot be retained
because they contain Bundles which can’t be persisted a new constrained version of Bundle,
PersistableBundle is added. PersistableBundle can store only basic data types. To use it
in your Activities you must declare the new activity:persistableMode attribute in the manifest.
*/
outPersistentState.putInt(KEY_EXTRA_NEW_DOCUMENT_COUNTER, mDocumentCounter);
super.onSaveInstanceState(outState, outPersistentState);
}
示例6: createProcessJobInfoBuilder
import android.os.PersistableBundle; //导入依赖的package包/类
public static JobInfo.Builder createProcessJobInfoBuilder(Context context, int jobId, QueuedSiteToSiteClientConfig queuedSiteToSiteClientConfig, ParcelableQueuedOperationResultCallback parcelableQueuedOperationResultCallback) {
JobInfo.Builder builder = new JobInfo.Builder(jobId, new ComponentName(context, SiteToSiteJobService.class));
PersistableBundle persistableBundle = new PersistableBundle();
SerializationUtils.putParcelable(queuedSiteToSiteClientConfig, persistableBundle, "config");
SerializationUtils.putParcelable(parcelableQueuedOperationResultCallback, persistableBundle, "callback");
builder.setExtras(persistableBundle);
return builder;
}
示例7: onSaveInstanceState
import android.os.PersistableBundle; //导入依赖的package包/类
/***************************************************/
@Override
public void onSaveInstanceState(Bundle outState, PersistableBundle outPersistentState) {
super.onSaveInstanceState(outState, outPersistentState);
outState.putString(EXTRA_BILL_ID,mBillId);
outState.putString(EXTRA_BILL_NAME,mBillName);
}
示例8: 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);
}
示例9: onPostCreate
import android.os.PersistableBundle; //导入依赖的package包/类
@Override
public void onPostCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
super.onPostCreate(savedInstanceState, persistentState);
// Restore state from PersistableBundle
if (persistentState != null) {
mDocumentCounter = persistentState.getInt(KEY_EXTRA_NEW_DOCUMENT_COUNTER);
}
}
示例10: onCreate
import android.os.PersistableBundle; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
super.onCreate(savedInstanceState, persistentState);/*
setContentView(R.layout.measurement_activity);
findViews();
setListener();*/
}
示例11: doInBackground
import android.os.PersistableBundle; //导入依赖的package包/类
@Override
protected Void doInBackground(Void... params) {
PersistableBundle bundle = mJobParameters.getExtras();
if (bundle == null) {
Log.e(TAG, "No data passed to task for job " + mJobParameters.getJobId());
return null;
}
String id = bundle.getString(ID_KEY);
String contentId = bundle.getString(CONTENT_ID_KEY);
long duration = bundle.getLong(DURATION_KEY);
long progress = bundle.getLong(PROGRESS_KEY);
String title = bundle.getString(TITLE_KEY);
String description = bundle.getString(DESCRIPTION_KEY);
String cardImageURL = bundle.getString(CARD_IMAGE_URL_KEY);
ClipData clipData = new ClipData.Builder().setClipId(id)
.setContentId(contentId)
.setDuration(duration)
.setProgress(progress)
.setTitle(title)
.setDescription(description)
.setCardImageUrl(cardImageURL)
.build();
SampleTvProvider.addWatchNextContinue(getApplicationContext(), clipData);
return null;
}
示例12: 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);
}
示例13: onSaveInstanceState
import android.os.PersistableBundle; //导入依赖的package包/类
@Override
public void onSaveInstanceState(Bundle outState, PersistableBundle outPersistentState) {
super.onSaveInstanceState(outState, outPersistentState);
outState.putString("firstname", firstname.getText().toString());
outState.putString("lastname", lastname.getText().toString());
outState.putString("email", username.getText().toString());
setViews(false);
}
示例14: callActivityOnCreate
import android.os.PersistableBundle; //导入依赖的package包/类
@Override
public void callActivityOnCreate(Activity activity, Bundle icicle, PersistableBundle persistentState) {
if (icicle != null) {
BundleCompat.clearParcelledData(icicle);
}
super.callActivityOnCreate(activity, icicle, persistentState);
}
示例15: onCreate
import android.os.PersistableBundle; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
setContentView(R.layout.activity_wellcomeinour);
ViewUtils.inject(this);
httpUtils=new HttpUtils();
mobile=telephoneNum.getText().toString();
}