本文整理匯總了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;
}