本文整理汇总了Java中android.os.Parcelable.getClass方法的典型用法代码示例。如果您正苦于以下问题:Java Parcelable.getClass方法的具体用法?Java Parcelable.getClass怎么用?Java Parcelable.getClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.os.Parcelable
的用法示例。
在下文中一共展示了Parcelable.getClass方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onRestoreInstanceState
import android.os.Parcelable; //导入方法依赖的package包/类
/**
* If the passed in state is a Bundle, an attempt is made to restore from it.
* @param state a Parcelable containing the current state
*/
@Override
protected void onRestoreInstanceState(Parcelable state) {
if (state.getClass() != Bundle.class) {
super.onRestoreInstanceState(state);
} else {
Bundle instanceState = (Bundle)state;
super.onRestoreInstanceState(instanceState.getParcelable(SUPER_STATE_KEY));
profileId = instanceState.getString(PROFILE_ID_KEY);
presetSizeType = instanceState.getInt(PRESET_SIZE_KEY);
isCropped = instanceState.getBoolean(IS_CROPPED_KEY);
queryWidth = instanceState.getInt(BITMAP_WIDTH_KEY);
queryHeight = instanceState.getInt(BITMAP_HEIGHT_KEY);
setImageBitmap((Bitmap)instanceState.getParcelable(BITMAP_KEY));
if (instanceState.getBoolean(PENDING_REFRESH_KEY)) {
refreshImage(true);
}
}
}
示例2: ParcelableEvent
import android.os.Parcelable; //导入方法依赖的package包/类
public ParcelableEvent(Parcelable event) {
klazz = event.getClass();
className = klazz.getCanonicalName();
parcelable = event;
}