本文整理汇总了Java中android.os.Bundle.getLong方法的典型用法代码示例。如果您正苦于以下问题:Java Bundle.getLong方法的具体用法?Java Bundle.getLong怎么用?Java Bundle.getLong使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.os.Bundle
的用法示例。
在下文中一共展示了Bundle.getLong方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initBundle
import android.os.Bundle; //导入方法依赖的package包/类
@Override
protected void initBundle(Bundle bundle) {
super.initBundle(bundle);
isShowIdentityView = bundle.getBoolean("isShowIdentityView", true);
mReqCatalog = bundle.getInt(BUNDLE_KEY_REQUEST_CATALOG, CATALOG_NEW);
switch (mReqCatalog) {
case CATALOG_FRIENDS:
case CATALOG_SOMEONE:
case CATALOG_MYSELF:
mUserId = bundle.getLong(BUNDLE_KEY_USER_ID, AccountHelper.getUserId());
break;
case CATALOG_TAG:
tag = bundle.getString(BUNDLE_KEY_TAG);
setHasOptionsMenu(true);
break;
}
}
示例2: BluetoothLeDevice
import android.os.Bundle; //导入方法依赖的package包/类
/**
* Instantiates a new bluetooth le device.
*
* @param in the in
*/
@SuppressWarnings("unchecked")
protected BluetoothLeDevice(final Parcel in) {
final Bundle b = in.readBundle(getClass().getClassLoader());
mCurrentRssi = b.getInt(PARCEL_EXTRA_CURRENT_RSSI, 0);
mCurrentTimestamp = b.getLong(PARCEL_EXTRA_CURRENT_TIMESTAMP, 0);
mDevice = b.getParcelable(PARCEL_EXTRA_BLUETOOTH_DEVICE);
mFirstRssi = b.getInt(PARCEL_EXTRA_FIRST_RSSI, 0);
mFirstTimestamp = b.getLong(PARCEL_EXTRA_FIRST_TIMESTAMP, 0);
mRecordStore = b.getParcelable(PARCEL_EXTRA_DEVICE_SCANRECORD_STORE);
mRssiLog = (Map<Long, Integer>) b.getSerializable(PARCEL_EXTRA_DEVICE_RSSI_LOG);
mScanRecord = b.getByteArray(PARCEL_EXTRA_DEVICE_SCANRECORD);
}
示例3: handleMessage
import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
switch (msg.what) {
case HANDLER_LOADING:
//实时更新进度
Bundle bundle = msg.getData();
long transferedBytes = bundle.getLong("transferedBytes");
long totalSize = bundle.getLong("totalSize");
mTvTextSize.setText(transferedBytes + "/" + totalSize);
//设置进度,百分比形式
mNumberProgressBar.setProgress((int) (((float)transferedBytes / (float) totalSize) *
100));
break;
case HANDLER_OK:
mTvTextSize.setText("下载成功");
//启动这个应用安装
startInstallApk();
break;
case HANDLER_FAIL:
mTvTextSize.setText("下载失败");
break;
}
}
示例4: onCreate
import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle args = getArguments();
if(args.containsKey("label_id")){
labelId = args.getLong("label_id");
}
if (savedInstanceState != null){
selected_color = savedInstanceState.getInt("selected_color");
labelId = savedInstanceState.getLong("label_id");
}
if(labelId != null){
Uri labelUri = ContentUris.withAppendedId(ToduleDBContract.TodoLabel.CONTENT_ID_URI_BASE, labelId);
Cursor cr = getContext().getContentResolver().query(labelUri, null, null, null, null);
cr.moveToFirst();
selected_color = cr.getInt(cr.getColumnIndexOrThrow(ToduleDBContract.TodoLabel.COLUMN_NAME_COLOR));
label_text = cr.getString(cr.getColumnIndexOrThrow(ToduleDBContract.TodoLabel.COLUMN_NAME_TAG));
label_text_color = cr.getInt(cr.getColumnIndexOrThrow(ToduleDBContract.TodoLabel.COLUMN_NAME_TEXT_COLOR));
cr.close();
}
}
示例5: setState
import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void setState(Bundle bundle) {
if (bundle != null) {
// Restore value of members from saved state
if (bundle.getString(I_STATIONS) != null) {
PreferredJourney journey = gson.fromJson(bundle.getString(I_STATIONS), PreferredJourney.class);
this.departureStation = journey.getStation1();
this.arrivalStation = journey.getStation2();
view.setStationNames(departureStation.getNameLong(), arrivalStation.getNameLong());
setFavouriteButtonStatus();
}
this.dateTime = new DateTime(bundle.getLong(I_TIME, DateTime.now().getMillis()));
this.isSearchComingFromSwipe = bundle.getBoolean(I_FROM_SWIPE, false);
} else {
}
}
示例6: onRestoreInstanceState
import android.os.Bundle; //导入方法依赖的package包/类
@Override
protected void onRestoreInstanceState(Bundle state) {
super.onRestoreInstanceState(state);
long id = state.getLong(GESTURES_INFO_ID, -1);
if (id != -1) {
final Set<String> entries = sStore.getGestureEntries();
out: for (String name : entries) {
for (Gesture gesture : sStore.getGestures(name)) {
if (gesture.getID() == id) {
mCurrentRenameGesture = new NamedGesture();
mCurrentRenameGesture.name = name;
mCurrentRenameGesture.gesture = gesture;
break out;
}
}
}
}
}
示例7: hasTokenInformation
import android.os.Bundle; //导入方法依赖的package包/类
/**
* Returns a boolean indicating whether a Bundle contains properties that
* could be a valid saved token.
*
* @param bundle
* A Bundle to check for token information.
* @return a boolean indicating whether a Bundle contains properties that
* could be a valid saved token.
*/
public static boolean hasTokenInformation(Bundle bundle) {
if (bundle == null) {
return false;
}
String token = bundle.getString(TOKEN_KEY);
if ((token == null) || (token.length() == 0)) {
return false;
}
long expiresMilliseconds = bundle.getLong(EXPIRATION_DATE_KEY, 0L);
if (expiresMilliseconds == 0L) {
return false;
}
return true;
}
示例8: onCreate
import android.os.Bundle; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_cloud_photos);
unbinder = ButterKnife.bind(this);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(Intent.ACTION_MEDIA_MOUNTED);
intentFilter.addAction(Intent.ACTION_MEDIA_UNMOUNTED);
intentFilter.addDataScheme("file");
Bundle bundle = getIntent().getExtras();
albumId = bundle.getLong("albumId", 0);
adapter = new CloudPhotosAdapter(this, cols);
adapter.addHeader(new View(this));
gridLayoutManager = new GridLayoutManager(this, cols);
recyclerView.setLayoutManager(gridLayoutManager);
recyclerView.setAdapter(adapter);
gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
return adapter.getSpanSize(position);
}
});
}
示例9: onActivityCreated
import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mActivityId = savedInstanceState != null ?
savedInstanceState.getLong(KEY_ACTIVITY_ID)
: NEXT_ID.getAndIncrement();
}
示例10: restoreState
import android.os.Bundle; //导入方法依赖的package包/类
/**
* Restore game state if our process is being relaunched
*
* @param icicle a Bundle containing the game state
*/
public void restoreState(Bundle icicle) {
setMode(PAUSE);
mAppleList = coordArrayToArrayList(icicle.getIntArray("mAppleList"));
mDirection = icicle.getInt("mDirection");
mNextDirection = icicle.getInt("mNextDirection");
mMoveDelay = icicle.getLong("mMoveDelay");
mScore = icicle.getLong("mScore");
mSnakeTrail = coordArrayToArrayList(icicle.getIntArray("mSnakeTrail"));
}
示例11: AccessTokenManager
import android.os.Bundle; //导入方法依赖的package包/类
/**
* 通过Parcel流构建AccessTokenManager,主要用在Parcelable.Creator中
*
* @param source Parcel 流信息
*/
public AccessTokenManager(Parcel source) {
Bundle bundle = Bundle.CREATOR.createFromParcel(source);
if (bundle != null) {
this.accessToken = bundle.getString(OauthConfig.BundleKey.KEY_ACCESS_TOKEN);
this.expireTime = bundle.getLong(OauthConfig.BundleKey.KEY_EXPIRE_TIME);
}
compareWithConfig();
}
示例12: onCreateView
import android.os.Bundle; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_tasks, container, false);
ButterKnife.bind(this, v);
Bundle bundle = getArguments();
state = bundle.getInt("state");
project_id = bundle.getLong("project_id");
return v;
}
示例13: onActivityResult
import android.os.Bundle; //导入方法依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_PLACE_PICKER) {
if (resultCode == Activity.RESULT_OK) {
Place place = PlacePicker.getPlace(this,data);
Map<String,Object>shareLocation=new HashMap<>();
shareLocation.put("time", ServerValue.TIMESTAMP);
//get data from Login Activity
Intent in=getIntent();
Bundle b=in.getExtras();
String name=b.getString("name");
Long number=b.getLong("contact_no");
Toast.makeText(this,"name: "+name+" number: "+number.toString(),Toast.LENGTH_SHORT).show();
//Map<String,Long>userData=new HashMap<>();
//userData.put(name,number);
Map userData=new HashMap();
userData.put(name,number);
mFirebase.child(FIREBASE_ROOT_NODE).child(place.getId()).setValue(shareLocation);
Firebase fire=new Firebase(FIREBASE_URL);
Firebase userRef=fire.child(FIREBASE_ROOT_NODE);
Firebase people=userRef.child(place.getId());
people.updateChildren(userData);
//mFirebase.child(FIREBASE_ROOT_NODE).child(place.getId());
//mFirebase.setValue(userData);
Toast.makeText(this,"added:"+name+" "+number,Toast.LENGTH_SHORT).show();
//Toast.makeText(this,"added location",Toast.LENGTH_SHORT).show();
} else if (resultCode == PlacePicker.RESULT_ERROR) {
Toast.makeText(this, "Places API failure! Check that the API is enabled for your key",
Toast.LENGTH_LONG).show();
}
} else {
super.onActivityResult(requestCode, resultCode, data);
}
}
示例14: onCreate
import android.os.Bundle; //导入方法依赖的package包/类
/**
* Subclasses must create a new BrowserAdapter and according to the adapter
* class, create a new ThumbnailRequester.
*/
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
mSelectedPosition=0;
mContext = getActivity().getApplicationContext();
mPreferences = PreferenceManager.getDefaultSharedPreferences(getActivity());
mThumbnailEngine = ThumbnailEngineVideo.getInstance(mContext);
mThumbnailEngine.setThumbnailSize(
getResources().getDimensionPixelSize(R.dimen.video_details_poster_width),
getResources().getDimensionPixelSize(R.dimen.video_details_poster_height));
Bundle posBundle = bundle!=null?bundle:getArguments();
if (posBundle != null) {
mFirstVisiblePosition = posBundle.getInt(FIRST_VISIBLE_POSITION);
mSelectedPosition = posBundle.getInt(SELECTED_POSITION);
mScroll = posBundle.getInt(CURRENT_SCROLL);
mListState= posBundle.getParcelable(LIST_STATE_KEY);
}
if (bundle != null) {
mCopyName = bundle.getString(COPY_NAME);
mCopyLength = bundle.getLong(COPY_LENGTH);
mCopyDialogID = bundle.getInt(COPY_DIALOG);
}
setHasOptionsMenu(true);
}
示例15: onBindViewHolder
import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
if (getArguments().getBundle("0") == null) {
holder.duration.setText("");
holder.durationLabel.setText("");
holder.fileSize.setText("");
holder.fileSizeLabel.setText("");
holder.fileName.setText("");
holder.fileNameLabel.setText("");
holder.userName.setText("No one else here");
holder.userNameLabel.setText("");
} else {
Bundle user = getArguments().getBundle(String.valueOf(position));
holder.userName.setText(user.getString("username"));
if (user.getLong("duration") == 0) {
holder.duration.setText("");
} else {
holder.duration.setText(String.valueOf(user.getLong("duration")));
}
if (user.getLong("size") == 0) {
holder.fileSize.setText("");
} else {
holder.fileSize.setText(String.valueOf(user.getLong("size")));
}
holder.fileName.setText(user.getString("filename"));
}
}