本文整理汇总了Java中android.content.Intent.getBooleanExtra方法的典型用法代码示例。如果您正苦于以下问题:Java Intent.getBooleanExtra方法的具体用法?Java Intent.getBooleanExtra怎么用?Java Intent.getBooleanExtra使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.content.Intent
的用法示例。
在下文中一共展示了Intent.getBooleanExtra方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onStart
import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onStart() {
super.onStart();
myHabitEventsListView = (ListView) findViewById(R.id.feed_list);
DummyMainActivity.myHabitEventsAdapter = new MyFeedAdapter(this, DummyMainActivity
.myHabitEvents);
myHabitEventsListView.setAdapter(DummyMainActivity.myHabitEventsAdapter);
//TODO change here
DummyMainActivity.myHabitEventsAdapter.notifyDataSetChanged();
Intent intent = getIntent();
if (intent.getBooleanExtra("fromHabit", false)){
refreshFeed2();
} else{
refreshFeed(null);
}
}
示例2: onReceive
import android.content.Intent; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
try {
Bundle bundle = intent.getExtras();
Log.d(TAG, "[MyReceiver] onReceive - " + intent.getAction() + ", extras: " + printBundle(bundle));
if (JPushInterface.ACTION_REGISTRATION_ID.equals(intent.getAction())) {
String regId = bundle.getString(JPushInterface.EXTRA_REGISTRATION_ID);
Log.d(TAG, "[MyReceiver] 接收Registration Id : " + regId);
//send the Registration Id to your server...
} else if (JPushInterface.ACTION_MESSAGE_RECEIVED.equals(intent.getAction())) {
Log.d(TAG, "[MyReceiver] 接收到推送下来的自定义消息: " + bundle.getString(JPushInterface.EXTRA_MESSAGE));
} else if (JPushInterface.ACTION_NOTIFICATION_RECEIVED.equals(intent.getAction())) {
Log.d(TAG, "[MyReceiver] 接收到推送下来的通知");
int notifactionId = bundle.getInt(JPushInterface.EXTRA_NOTIFICATION_ID);
Log.d(TAG, "[MyReceiver] 接收到推送下来的通知的ID: " + notifactionId);
processCustomMessage(context,bundle);
} else if (JPushInterface.ACTION_NOTIFICATION_OPENED.equals(intent.getAction())) {
Log.d(TAG, "[MyReceiver] 用户点击打开了通知");
openNotification(context);
} else if (JPushInterface.ACTION_RICHPUSH_CALLBACK.equals(intent.getAction())) {
Log.d(TAG, "[MyReceiver] 用户收到到RICH PUSH CALLBACK: " + bundle.getString(JPushInterface.EXTRA_EXTRA));
//在这里根据 JPushInterface.EXTRA_EXTRA 的内容处理代码,比如打开新的Activity, 打开一个网页等..
} else if(JPushInterface.ACTION_CONNECTION_CHANGE.equals(intent.getAction())) {
boolean connected = intent.getBooleanExtra(JPushInterface.EXTRA_CONNECTION_CHANGE, false);
Log.d(TAG, "[MyReceiver]" + intent.getAction() +" connected state change to "+connected);
} else {
Log.d(TAG, "[MyReceiver] Unhandled intent - " + intent.getAction());
}
} catch (Exception e){
}
}
示例3: onNewIntent
import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
if (intent.getBooleanExtra(KEY_OPENED_FROM_NOTIFICATION,false)){
intent.putExtra(KEY_OPENED_FROM_NOTIFICATION,false);
clearBackStack(getFragmentManager());
replaceFragment(POSITION_MAIN);
} else if (intent.getBooleanExtra(KEY_OPENED_FROM_WIDGET,false)){
intent.putExtra(KEY_OPENED_FROM_WIDGET,false);
clearBackStack(getFragmentManager());
replaceFragment(POSITION_MAIN);
}
}
示例4: makeTokenFromIntent
import android.content.Intent; //导入方法依赖的package包/类
private Token makeTokenFromIntent(Intent data) {
String type = data.getStringExtra(TYPE);
byte[] secret = data.getByteArrayExtra(SECRET);
String label = data.getStringExtra(LABEL);
int digits = data.getIntExtra(DIGITS, 6);
String algorithm = data.getStringExtra(ALGORITHM);
Token tmp = new Token(secret, label, type, digits);
if (type.equals(TOTP)) {
int period = data.getIntExtra(PERIOD, 30);
tmp.setPeriod(period);
}
if (algorithm != null) {
tmp.setAlgorithm(algorithm);
}
if (data.getBooleanExtra(WITHPIN, false)) {
tmp.setWithPIN(true);
}
return tmp;
}
示例5: onNewIntent
import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
if (intent != null) {
boolean isExit = intent.getBooleanExtra(TAG_EXIT, false);
if (isExit) {
this.finish();
}
}
}
示例6: handleBluetoothChange
import android.content.Intent; //导入方法依赖的package包/类
private void handleBluetoothChange(Intent intent) {
this.bluetoothAvailable = intent.getBooleanExtra(EXTRA_AVAILABLE, false);
if (recipient != null) {
sendMessage(viewModelStateFor(callState), recipient, localVideoEnabled, remoteVideoEnabled, bluetoothAvailable, microphoneEnabled);
}
}
示例7: onActivityResult
import android.content.Intent; //导入方法依赖的package包/类
/**
* For sending user to different activities
* @param requestCode
* @param resultCode
* @param data
*/
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(data != null && data.getBooleanExtra("fromHabit", false)){
setResult(DummyMainActivity.VIEW_FEED, data);
finish();
}
if(requestCode == ADDING_EVENT){
}
DummyMainActivity.myHabitsAdapter.notifyDataSetChanged();
}
示例8: buildDefaultState
import android.content.Intent; //导入方法依赖的package包/类
private void buildDefaultState() {
mState = new State();
final Intent intent = getIntent();
mState.action = State.ACTION_MANAGE_ALL;
mState.acceptMimes = new String[] { "*/*" };
mState.allowMultiple = true;
mState.acceptMimes = new String[] { intent.getType() };
mState.localOnly = intent.getBooleanExtra(Intent.EXTRA_LOCAL_ONLY, false);
mState.forceAdvanced = intent.getBooleanExtra(DocumentsContract.EXTRA_SHOW_ADVANCED, false);
mState.showAdvanced = mState.forceAdvanced
| SettingsActivity.getDisplayAdvancedDevices(this);
mState.showSize = true;
}
示例9: onStart
import android.content.Intent; //导入方法依赖的package包/类
/**
* Called when activity starts, retrieves habits from server or offline list
*/
@Override
protected void onStart() {
super.onStart();
//TODO 2 searching another user habits for viewing
Intent intent = getIntent();
ArrayList<Habit> habitList;
if(intent != null && intent.getBooleanExtra("fromProfile", false)){
isFromProfile = true;
if(Utilities.isNetworkAvailable(HabitTabActivity.this)){
ElasticsearchController.GetItemsTask getHabitsArrayGetTask = new ElasticsearchController.GetItemsTask();
getHabitsArrayGetTask.execute(DummyMainActivity.Habit_Index, "username", intent.getStringExtra("targetUsername"));
try{
JsonArray jsonHabits = getHabitsArrayGetTask.get();
habitList = new ArrayList<>();
for (int i = 0; i < jsonHabits.size(); i++){
Habit h = new Habit();
JsonObject job = jsonHabits.get(i).getAsJsonObject();
h.fromJsonObject(job);
habitList.add(h);
}
}catch (Exception e){
habitList = null;
Log.d("ESC", "Adding habits in login.");
}
}else{
habitList = null;
DummyMainActivity.toastMe("No internet", HabitTabActivity.this);
}
}else {
isFromProfile = false;
habitList = DummyMainActivity.myHabits;
}
myHabitsListView = (ListView) findViewById(R.id.habits_listview);
DummyMainActivity.myHabitsAdapter = new MyHabitsAdapter(HabitTabActivity.this, habitList);
myHabitsListView.setAdapter(DummyMainActivity.myHabitsAdapter);
DummyMainActivity.myHabitsAdapter.notifyDataSetChanged();
}
示例10: onNewIntent
import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onNewIntent(Intent intent) {
startForCheckPermissions = intent.getBooleanExtra("checkPermissions", false);
if (!requestCallPermissions(RongCallCommon.CallMediaType.VIDEO, REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS)) {
return;
}
initViews();
setupIntent();
super.onNewIntent(intent);
}
示例11: isFromPush
import android.content.Intent; //导入方法依赖的package包/类
private boolean isFromPush(Intent intent) {
boolean z = false;
this.mLaunchByPush = intent.getBooleanExtra(MyDownloadActivityConfig.FROM_PUSH, false);
if (intent.getBooleanExtra("isLivePush", false) || intent.getIntExtra("LaunchMode", 0) == 19 || intent.getIntExtra("LaunchMode", 0) == 20) {
z = true;
}
this.mIsLivePush = z;
if (this.mIsLivePush) {
BaseApplication.getInstance().setPush(true);
}
return this.mLaunchByPush;
}
示例12: onReceive
import android.content.Intent; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
if (onRequestPermissionsCallBack == null) {
return;
}
boolean result = intent.getBooleanExtra(Constants.GRANT, false);
if (result) {
onRequestPermissionsCallBack.onGrant();
} else {
String permission = intent.getStringExtra(Constants.DENIED);
onRequestPermissionsCallBack.onDenied(permission);
}
LocalBroadcastManager.getInstance(PermissionWrapper.this.context).unregisterReceiver(callBackBroadcastReceiver);
}
示例13: onReceive
import android.content.Intent; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
Boolean lNoConnectivity = intent.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY,false);
if (LinphoneManager.isInstanciated()) {
LinphoneManager.getInstance().connectivityChanged(cm, lNoConnectivity);
}
}
示例14: onStartCommand
import android.content.Intent; //导入方法依赖的package包/类
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
LOGD(TAG, "onStartCommand");
if (intent != null) {
String action = intent.getAction();
if (ACTION_VISIBILITY.equals(action)) {
mVisible = intent.getBooleanExtra(NOTIFICATION_VISIBILITY, false);
LOGD(TAG, "onStartCommand(): Action: ACTION_VISIBILITY " + mVisible);
onRemoteMediaPlayerStatusUpdated(mCastManager.getPlaybackStatus());
if (mNotification == null) {
try {
setUpNotification(mCastManager.getRemoteMediaInformation());
} catch (TransientNetworkDisconnectionException | NoConnectionException e) {
LOGE(TAG, "onStartCommand() failed to get media", e);
}
}
if (mVisible && mNotification != null) {
startForeground(NOTIFICATION_ID, mNotification);
} else {
stopForeground(true);
}
}
}
return Service.START_STICKY;
}
示例15: initDataFromIntent
import android.content.Intent; //导入方法依赖的package包/类
private void initDataFromIntent() {
Intent intent = getIntent();
this.mPlayType = intent.getIntExtra(PlayConstant.PLAY_TYPE, 0);
this.mLaunchMode = intent.getIntExtra("launchMode", 0);
this.mFromLaunch = intent.getIntExtra("from", 0);
this.mFull = intent.getBooleanExtra(PlayConstant.LIVE_FULL_ONLY, false);
this.mIsPanoramaVideo = intent.getSerializableExtra(PlayConstant.VIDEO_TYPE) == VideoType.Panorama;
if (this.mLaunchMode == 0) {
String path = null;
if (!(getIntent() == null || getIntent().getData() == null)) {
Uri uriPath = getIntent().getData();
String scheme = uriPath.getScheme();
path = (scheme == null || scheme.equals(IDataSource.SCHEME_FILE_TAG)) ? uriPath.getPath() : uriPath.toString();
}
this.mLaunchMode = 1;
intent.putExtra("launchMode", 1);
intent.putExtra(PlayConstant.URI, path);
intent.putExtra("seek", 0);
intent.putExtra(PlayConstant.PLAY_MODE, 1);
}
if (this.mFromLaunch == 13) {
LetvApplication.getInstance().setPush(true);
} else if (intent.getBooleanExtra("isFromPush", false)) {
LetvApplication.getInstance().setPush(true);
} else if (intent.getBooleanExtra("isLiveFromPush", false)) {
LetvApplication.getInstance().setPush(true);
}
}