本文整理汇总了Java中android.os.Bundle.getParcelable方法的典型用法代码示例。如果您正苦于以下问题:Java Bundle.getParcelable方法的具体用法?Java Bundle.getParcelable怎么用?Java Bundle.getParcelable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.os.Bundle
的用法示例。
在下文中一共展示了Bundle.getParcelable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onRestoreInstanceState
import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onRestoreInstanceState(Parcelable state) {
if (state instanceof Bundle) {
Bundle bundle = (Bundle) state;
normalizedScale = bundle.getFloat("saveScale");
m = bundle.getFloatArray("matrix");
prevMatrix.setValues(m);
prevMatchViewHeight = bundle.getFloat("matchViewHeight");
prevMatchViewWidth = bundle.getFloat("matchViewWidth");
prevViewHeight = bundle.getInt("viewHeight");
prevViewWidth = bundle.getInt("viewWidth");
imageRenderedAtLeastOnce = bundle.getBoolean("imageRendered");
super.onRestoreInstanceState(bundle.getParcelable("instanceState"));
return;
}
super.onRestoreInstanceState(state);
}
示例2: onRestoreInstanceState
import android.os.Bundle; //导入方法依赖的package包/类
@Override
protected void onRestoreInstanceState(Bundle state) {
super.onRestoreInstanceState(state);
Alarm alarmFromBundle = new Alarm(state.getString(KEY_ORIGINAL_ALARM));
if (alarmFromBundle != null) {
mOriginalAlarm = alarmFromBundle;
}
alarmFromBundle = new Alarm(state.getString(KEY_CURRENT_ALARM));
if (alarmFromBundle != null) {
updatePrefs(alarmFromBundle);
}
Bundle b = state.getParcelable(KEY_TIME_PICKER_BUNDLE);
if (b != null) {
showTimePicker();
mTimePickerDialog.onRestoreInstanceState(b);
}
}
示例3: onRestoreInstanceState
import android.os.Bundle; //导入方法依赖的package包/类
@Override public void onRestoreInstanceState(Parcelable state) {
if (state instanceof Bundle) {
Bundle bundle = (Bundle) state;
alpha = bundle.getInt("alpha");
hue = bundle.getFloat("hue");
sat = bundle.getFloat("sat");
val = bundle.getFloat("val");
showAlphaPanel = bundle.getBoolean("show_alpha");
alphaSliderText = bundle.getString("alpha_text");
state = bundle.getParcelable("instanceState");
}
super.onRestoreInstanceState(state);
}
示例4: onCreateView
import android.os.Bundle; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_tab_list, container, false);
Utils.logD(LOG_TAG, "onCreateView:" + this);
unbinder = ButterKnife.bind(this, view);
setUpRecyclerView();
setUpSwipeRefreshLayout();
if (savedInstanceState == null) {
mPresenter.onGetAddressFromLocation(mLocation);
} else {
mRotation = true;
if (savedInstanceState.containsKey(RECYCLER_STATE_KEY)) {
mLayoutManagerState = savedInstanceState.getParcelable(RECYCLER_STATE_KEY);
}
if (savedInstanceState.containsKey(ADDRESS_KEY)) {
mAddress = savedInstanceState.getString(ADDRESS_KEY);
}
}
return view;
}
示例5: onConnected
import android.os.Bundle; //导入方法依赖的package包/类
/**
* Called when we successfully obtain a connection to a client.
*/
@Override
public void onConnected(Bundle connectionHint) {
debugLog("onConnected: connected!");
if (connectionHint != null) {
debugLog("onConnected: connection hint provided. Checking for invite.");
Invitation inv = connectionHint
.getParcelable(Multiplayer.EXTRA_INVITATION);
if (inv != null && inv.getInvitationId() != null) {
// retrieve and cache the invitation ID
debugLog("onConnected: connection hint has a room invite!");
mInvitation = inv;
debugLog("Invitation ID: " + mInvitation.getInvitationId());
}
// Do we have any requests pending?
mRequests = Games.Requests
.getGameRequestsFromBundle(connectionHint);
if (!mRequests.isEmpty()) {
// We have requests in onConnected's connectionHint.
debugLog("onConnected: connection hint has " + mRequests.size()
+ " request(s)");
}
debugLog("onConnected: connection hint provided. Checking for TBMP game.");
mTurnBasedMatch = connectionHint
.getParcelable(Multiplayer.EXTRA_TURN_BASED_MATCH);
}
// we're good to go
succeedSignIn();
}
示例6: onCreate
import android.os.Bundle; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.setpickedimage);
context = this;
if (savedInstanceState == null) {
Intent intent = getIntent();
if (intent == null) {
uri = null;
} else {
uri = intent.getParcelableExtra("imageUri");
}
} else {
uri = savedInstanceState.getParcelable("imageUri");
}
setRGBColorButton=(Button) findViewById(R.id.button);
setHEXColorButton=(Button) findViewById(R.id.button2);
setRGBColorTextView=(TextView) findViewById(R.id.textView2);
setHEXColorTextView=(TextView) findViewById(R.id.textView3);
picked_imageView = (ImageView) findViewById(R.id.imageView2);
picked_imageView.setOnTouchListener(this);
String uriString = getRealPathFromURI(uri);
picked_imageView.setImageBitmap(decodeSampledBitmapFromResource(uriString, 100, 100));
}
示例7: readParcelableMap
import android.os.Bundle; //导入方法依赖的package包/类
public static <T extends Parcelable> Map<String, T> readParcelableMap(Parcel parcel) {
Map<String, T> map = new ArrayMap<>();
Bundle bundle = parcel.readBundle(Parcelables.class.getClassLoader());
for (String key : bundle.keySet()) {
T parcelable = bundle.getParcelable(key);
map.put(key, parcelable);
}
return map;
}
示例8: onRestoreInstanceState
import android.os.Bundle; //导入方法依赖的package包/类
@Override
protected void onRestoreInstanceState(Parcelable state) {
if (state instanceof Bundle) {
Bundle bundle = (Bundle) state;
mCurrentTab = bundle.getInt("mCurrentTab");
state = bundle.getParcelable("instanceState");
if (mCurrentTab != 0 && mTabsContainer.getChildCount() > 0) {
updateTabSelection(mCurrentTab);
scrollToCurrentTab();
}
}
super.onRestoreInstanceState(state);
}
示例9: onCreate
import android.os.Bundle; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
if (savedInstanceState != null)
data = savedInstanceState.getParcelable(DATA); //Restore data if they exist
else
connectData(); //Connect new data if non exist
setActivity(); //link activity
super.onCreate(savedInstanceState);
}
示例10: onCreate
import android.os.Bundle; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_input_arrival);
setTitle(R.string.titleArrival);
txtArrivalDate = (TextView) findViewById(R.id.txtArrivalDate);
txtArrivalTime = (TextView) findViewById(R.id.txtArrivalTime);
txtArrivalStation = (TextView) findViewById(R.id.txtLocation);
Bundle data = getIntent().getExtras();
currentTravel = data.getParcelable("travel");
setArrivalDateTime(GregorianCalendar.getInstance());
locationObserver = new Observer() {
@Override
public void update(Observable o, Object arg) {
Log.i(TAG, "update: Stopping Location");
LocationProxy.getInstance().stopRequest(getApplicationContext());
autoSelectStation();
}
};
Log.i(TAG, "onCreate: AddObserver");
LocationProxy.getInstance().addObserver(locationObserver);
autoSelectStation();
}
示例11: onCreate
import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
this.setCancelable(true);
if (savedInstanceState != null) {
if (builder != null) {
builder = (Builder) savedInstanceState.getParcelable(Builder.class.getSimpleName());
}
}
setRetainInstance(true);
super.onCreate(savedInstanceState);
}
示例12: onActivityResult
import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK) {
switch (requestCode) {
case REQUEST_CUT_PHOTO: //发送本地图片
if (data != null) {
if (Build.VERSION.SDK_INT < 23 || new File(cuttedPicturePath).exists() == false) {
Bundle bundle = data.getExtras();
if (bundle != null) {
Bitmap photo = bundle.getParcelable("data");
//photo.
if (photo != null) {
//照片的路径
setCuttedPicturePath();
cuttedPicturePath = CommonUtil.savePhotoToSDCard(cuttedPicturePath, cuttedPictureName, "jpg", photo);
}
}
}
setResult(RESULT_OK, new Intent().putExtra(RESULT_PICTURE_PATH, cuttedPicturePath));
}
break;
default:
break;
}
}
finish();
}
示例13: onCreate
import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = getIntent();
wxapi = WXAPIFactory.createWXAPI(this, AllShare.getWxId(), true);
boolean registered = wxapi.registerApp(AllShare.getWxId());
// 若是接收结果,处理完直接finish
if (wxapi.handleIntent(intent, this)) {
finish();
return;
}
Bundle bundle;
boolean paramError = false;
if (!registered) {
LogUtils.e("%s: api is null, finish.", TAG);
paramError = true;
} else if (null == intent || null == (bundle = intent.getExtras())) {
LogUtils.e("%s: params is null, finish.", TAG);
paramError = true;
} else {
bundle.setClassLoader(WXContent.class.getClassLoader());
if (null == (shareContent = bundle.getParcelable(KEY_SHARE_CONTENT))) {
LogUtils.e("%s: share content is null, finish.", TAG);
paramError = true;
} else if (null == (listener = bundle.getParcelable(KEY_SHARE_LISTENER))) {
LogUtils.e("%s: result receiver is null.", TAG);
}
}
if (paramError) {
Toast.makeText(this, R.string.share_failed, Toast.LENGTH_SHORT).show();
finish();
return;
}
share();
}
示例14: onActivityResult
import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Log.i(TAG, String.valueOf(requestCode));
Log.i(TAG, String.valueOf(resultCode));
if (resultCode != RESULT_OK) {
return;
}
switch (requestCode) {
case PICK_FROM_ALBUM: {
mlmageCaptureUri = data.getData();
Log.i(TAG, "test2");
}
case PICK_FROM_CAMERA: {
Log.i(TAG, "test3");
Intent intent = new Intent("com.android.camera.action.CROP");
intent.setDataAndType(mlmageCaptureUri, "image/*");
intent.putExtra("outputX", 100);
intent.putExtra("outputY", 100);
intent.putExtra("aspectX", 1);
intent.putExtra("aspectY", 1);
intent.putExtra("scale", true);
intent.putExtra("return-data", true);
startActivityForResult(intent, CROP_FROM_IMAGE);
break;
}
case CROP_FROM_IMAGE: {
if (resultCode != RESULT_OK) {
return;
}
Log.i(TAG, "test4");
final Bundle extras = data.getExtras();
String filePath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/temp/" + System.currentTimeMillis() + ".jpg";
if (extras != null) {
bitmap = extras.getParcelable("data");
iv_UserPhoto.setImageBitmap(bitmap);
imageUpload();
storeCropImage(bitmap, filePath);
break;
}
//임시파일 삭제
File f = new File(mlmageCaptureUri.getPath());
if (f.exists()) {
f.delete();
}
break;
}
}
}
示例15: onRestoreInstanceState
import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onRestoreInstanceState(Parcelable state) {
if (state instanceof Bundle) {
Bundle bundle = (Bundle) state;
// prevent restoring state if already set by outside code
if (mBitmapLoadingWorkerTask == null && mLoadedImageUri == null && mBitmap == null && mImageResource == 0) {
Uri uri = bundle.getParcelable("LOADED_IMAGE_URI");
if (uri != null) {
String key = bundle.getString("LOADED_IMAGE_STATE_BITMAP_KEY");
if (key != null) {
Bitmap stateBitmap = BitmapUtils.mStateBitmap != null && BitmapUtils.mStateBitmap.first.equals(key)
? BitmapUtils.mStateBitmap.second.get() : null;
if (stateBitmap != null && !stateBitmap.isRecycled()) {
BitmapUtils.mStateBitmap = null;
setBitmap(stateBitmap, uri, bundle.getInt("LOADED_SAMPLE_SIZE"), 0);
}
}
if (mLoadedImageUri == null) {
setImageUriAsync(uri);
}
} else {
int resId = bundle.getInt("LOADED_IMAGE_RESOURCE");
if (resId > 0) {
setImageResource(resId);
} else {
Bitmap bitmap = bundle.getParcelable("SET_BITMAP");
if (bitmap != null) {
setBitmap(bitmap);
} else {
uri = bundle.getParcelable("LOADING_IMAGE_URI");
if (uri != null) {
setImageUriAsync(uri);
}
}
}
}
mDegreesRotated = bundle.getInt("DEGREES_ROTATED");
mCropOverlayView.setInitialCropWindowRect((Rect) bundle.getParcelable("INITIAL_CROP_RECT"));
mRestoreCropWindowRect = bundle.getParcelable("CROP_WINDOW_RECT");
mCropOverlayView.setCropShape(CropShape.valueOf(bundle.getString("CROP_SHAPE")));
mAutoZoomEnabled = bundle.getBoolean("CROP_AUTO_ZOOM_ENABLED");
mMaxZoom = bundle.getInt("CROP_MAX_ZOOM");
}
super.onRestoreInstanceState(bundle.getParcelable("instanceState"));
} else {
super.onRestoreInstanceState(state);
}
}