本文整理了Java中android.content.Intent.getBooleanExtra()
方法的一些代码示例,展示了Intent.getBooleanExtra()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Intent.getBooleanExtra()
方法的具体详情如下:
包路径:android.content.Intent
类名称:Intent
方法名:getBooleanExtra
暂无
代码示例来源:origin: Tencent/tinker
public static boolean getBooleanExtra(Intent intent, String name, boolean defaultValue) {
if (null == intent) {
return defaultValue;
}
boolean ret = defaultValue;
try {
ret = intent.getBooleanExtra(name, defaultValue);
} catch (Exception e) {
Log.e(TAG, "getBooleanExtra exception:" + e.getMessage());
ret = defaultValue;
}
return ret;
}
代码示例来源:origin: TeamNewPipe/NewPipe
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, false)) {
handleConnectivityChange(null);
return;
}
handleConnectivityChange(intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO));
}
};
代码示例来源:origin: commonsguy/cw-omnibus
private String getEventLabel(Intent event) {
if (event.getAction()==null) {
return("explicit");
}
else if (event.getBooleanExtra(TestReceiver.EXTRA_IS_FANOUT, false)) {
return("fanout");
}
return("implicit");
}
}
代码示例来源:origin: stackoverflow.com
@Override
public void onReceive(Context context, Intent intent) {
final String action = intent.getAction();
if (action.equals(WifiManager.SUPPLICANT_CONNECTION_CHANGE_ACTION)) {
if (intent.getBooleanExtra(WifiManager.EXTRA_SUPPLICANT_CONNECTED, false)){
//do stuff
} else {
// wifi connection was lost
}
}
}
代码示例来源:origin: commonsguy/cw-omnibus
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
String playlist=intent.getStringExtra(EXTRA_PLAYLIST);
boolean useShuffle=intent.getBooleanExtra(EXTRA_SHUFFLE, false);
play(playlist, useShuffle);
return(START_NOT_STICKY);
}
代码示例来源:origin: stackoverflow.com
public class NetworkStateReceiver extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) {
Log.d("app","Network connectivity change");
if(intent.getExtras()!=null) {
NetworkInfo ni=(NetworkInfo) intent.getExtras().get(ConnectivityManager.EXTRA_NETWORK_INFO);
if(ni!=null && ni.getState()==NetworkInfo.State.CONNECTED) {
Log.i("app","Network "+ni.getTypeName()+" connected");
} else if(intent.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY,Boolean.FALSE)) {
Log.d("app","There's no network connectivity");
}
}
}
代码示例来源:origin: commonsguy/cw-omnibus
@Override
protected void onHandleIntent(Intent intent) {
if (Intent.ACTION_OPEN_DOCUMENT.equals(intent.getAction())) {
load(intent.getData());
}
else if (Intent.ACTION_EDIT.equals(intent.getAction())) {
save(intent.getData(),
intent.getStringExtra(Intent.EXTRA_TEXT),
intent.getBooleanExtra(EXTRA_CLOSING, false));
}
}
代码示例来源:origin: commonsguy/cw-omnibus
@Override
public void onHandleWork(Intent i) {
Log.d(getClass().getSimpleName(), "scheduled work begins");
if (i.getBooleanExtra(PollReceiver.EXTRA_IS_DOWNLOAD, false)) {
new DownloadJob().run(); // do synchronously, as we are on
// a background thread already
}
Log.d(getClass().getSimpleName(), "scheduled work ends");
}
}
代码示例来源:origin: commonsguy/cw-omnibus
@Override
public void onHandleWork(Intent i) {
Log.d(getClass().getSimpleName(), "scheduled work begins");
if (i.getBooleanExtra(PollReceiver.EXTRA_IS_DOWNLOAD, false)) {
new DownloadJob().run(); // do synchronously, as we are on
// a background thread already
}
Log.d(getClass().getSimpleName(), "scheduled work ends");
}
}
代码示例来源:origin: commonsguy/cw-omnibus
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
Log.d("DemoService", "onStartCommand()");
boolean foreground=intent.getBooleanExtra(EXTRA_FOREGROUND, false);
boolean importantish=intent.getBooleanExtra(EXTRA_IMPORTANTISH, false);
if (foreground) {
String channel=importantish ? CHANNEL_LOW : CHANNEL_MIN;
startForeground(1337, buildForegroundNotification(channel));
}
return(super.onStartCommand(intent, flags, startId));
}
代码示例来源:origin: smuyyh/BookReader
@Override
public void initToolBar() {
mIsDiscussion = getIntent().getBooleanExtra(INTENT_DIS, false);
if (mIsDiscussion) {
mCommonToolbar.setTitle("综合讨论区");
} else {
mCommonToolbar.setTitle("原创区");
}
mCommonToolbar.setNavigationIcon(R.drawable.ab_back);
}
代码示例来源:origin: nickbutcher/plaid
@Override
protected void onHandleIntent(Intent intent) {
if (intent == null) return;
if (ACTION_POST_NEW_STORY.equals(intent.getAction())) {
final boolean broadcastResult = intent.getBooleanExtra(EXTRA_BROADCAST_RESULT, false);
if (!repository.isLoggedIn()) return; // shouldn't happen...
final String title = intent.getStringExtra(EXTRA_STORY_TITLE);
final String url = intent.getStringExtra(EXTRA_STORY_URL);
final String comment = intent.getStringExtra(EXTRA_STORY_COMMENT);
if (TextUtils.isEmpty(title)) return;
NewStoryRequest storyToPost = getNewStoryRequest(title, url, comment);
if (storyToPost == null) return;
postStory(broadcastResult, service, repository.getUser(), storyToPost);
}
}
代码示例来源:origin: CarGuo/GSYVideoPlayer
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_play_pick);
ButterKnife.bind(this);
isTransition = getIntent().getBooleanExtra(TRANSITION, false);
init();
}
代码示例来源:origin: CarGuo/GSYVideoPlayer
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_play_empty_control);
ButterKnife.bind(this);
isTransition = getIntent().getBooleanExtra(TRANSITION, false);
init();
}
代码示例来源:origin: CarGuo/GSYVideoPlayer
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_play);
ButterKnife.bind(this);
isTransition = getIntent().getBooleanExtra(TRANSITION, false);
init();
}
代码示例来源:origin: commonsguy/cw-omnibus
@Override
public void onReceive(Context ctxt, Intent i) {
boolean isDownload=i.getBooleanExtra(EXTRA_IS_DOWNLOAD, false);
DemoScheduledService.enqueueWork(ctxt,
new Intent(ctxt, DemoScheduledService.class)
.putExtra(EXTRA_IS_DOWNLOAD, isDownload));
long period=i.getLongExtra(EXTRA_PERIOD, -1);
if (period>0) {
scheduleExactAlarm(ctxt,
(AlarmManager)ctxt.getSystemService(Context.ALARM_SERVICE),
period, isDownload);
}
}
代码示例来源:origin: commonsguy/cw-omnibus
@Override
public void onReceive(Context ctxt, Intent i) {
boolean isDownload=i.getBooleanExtra(EXTRA_IS_DOWNLOAD, false);
DemoScheduledService.enqueueWork(ctxt,
new Intent(ctxt, DemoScheduledService.class)
.putExtra(EXTRA_IS_DOWNLOAD, isDownload));
long period=i.getLongExtra(EXTRA_PERIOD, -1);
if (period>0) {
scheduleExactAlarm(ctxt,
(AlarmManager)ctxt.getSystemService(Context.ALARM_SERVICE),
period, isDownload);
}
}
代码示例来源:origin: ACRA/acra
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
if (intent.hasExtra(EXTRA_ACRA_CONFIG)) {
final boolean onlySendSilentReports = intent.getBooleanExtra(EXTRA_ONLY_SEND_SILENT_REPORTS, false);
final CoreConfiguration config = (CoreConfiguration) intent.getSerializableExtra(EXTRA_ACRA_CONFIG);
new SendingConductor(this, config).sendReports(onlySendSilentReports);
} else {
if (ACRA.DEV_LOGGING) ACRA.log.d(LOG_TAG, "SenderService was started but no valid intent was delivered, will now quit");
}
return START_REDELIVER_INTENT;
}
代码示例来源:origin: k9mail/k-9
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setLayout(R.layout.account_setup_account_type);
findViewById(R.id.pop).setOnClickListener(this);
findViewById(R.id.imap).setOnClickListener(this);
findViewById(R.id.webdav).setOnClickListener(this);
String accountUuid = getIntent().getStringExtra(EXTRA_ACCOUNT);
mAccount = Preferences.getPreferences(this).getAccount(accountUuid);
mMakeDefault = getIntent().getBooleanExtra(EXTRA_MAKE_DEFAULT, false);
}
代码示例来源:origin: jdamcd/android-crop
public void testAsPngSetAsExtras() {
builder.asPng(true);
Intent intent = builder.getIntent(activity);
assertThat(intent.getBooleanExtra("as_png", false)).isEqualTo(true);
}
}
内容来源于网络,如有侵权,请联系作者删除!