List of usage examples for android.content Intent getIntExtra
public int getIntExtra(String name, int defaultValue)
From source file:com.alex.vmandroid.display.voice.store.StoreDbRecordActivity.java
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_store_db_record); Intent intent = getIntent(); int storeId = intent.getIntExtra("StoreId", -1); mTitle = intent.getStringExtra("StoreTitle"); StoreDbRecordFragment fragment = StoreDbRecordFragment.newInstance(); new StoreDbRecordPresenter(fragment, storeId, mTitle); FragmentManager fragmentManager = getSupportFragmentManager(); FragmentTransaction transaction = fragmentManager.beginTransaction(); transaction.replace(R.id.store_db_record_frame_layout, fragment); transaction.commit();/*w w w. j a v a2 s . c om*/ }
From source file:org.metawatch.manager.Monitors.java
private static void createWifiReceiver(final Context context) { if (wifiReceiver != null) return;//from w w w . j a va 2 s . com WifiManager wm = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); WifiInfo info = wm.getConnectionInfo(); if (info != null) SignalData.wifiBars = 1 + WifiManager.calculateSignalLevel(info.getRssi(), 4); wifiReceiver = new BroadcastReceiver() { int wifiBars = 0; @Override public void onReceive(Context c, Intent intent) { String action = intent.getAction(); if (action.equals(WifiManager.WIFI_STATE_CHANGED_ACTION)) { if (intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE, WifiManager.WIFI_STATE_UNKNOWN) != WifiManager.WIFI_STATE_ENABLED) { wifiBars = 0; } } else if (action.equals(WifiManager.SUPPLICANT_CONNECTION_CHANGE_ACTION)) { if (!intent.getBooleanExtra(WifiManager.EXTRA_SUPPLICANT_CONNECTED, false)) { wifiBars = 0; } } else if (action.equals(WifiManager.NETWORK_STATE_CHANGED_ACTION)) { NetworkInfo netInfo = intent.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO); if (netInfo.getState() != NetworkInfo.State.CONNECTED) { wifiBars = 0; } else { WifiInfo wifiInfo = intent.getParcelableExtra(WifiManager.EXTRA_WIFI_INFO); if (wifiInfo == null) { wifiBars = 0; } else { wifiBars = 1 + WifiManager.calculateSignalLevel(wifiInfo.getRssi(), 4); } } } else if (action.equals(WifiManager.RSSI_CHANGED_ACTION)) { final int newRssi = intent.getIntExtra(WifiManager.EXTRA_NEW_RSSI, -200); wifiBars = 1 + WifiManager.calculateSignalLevel(newRssi, 4); } if (wifiBars != SignalData.wifiBars) { SignalData.wifiBars = wifiBars; Idle.updateIdle(context, true); } } }; IntentFilter f = new IntentFilter(); f.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION); f.addAction(WifiManager.SUPPLICANT_CONNECTION_CHANGE_ACTION); f.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION); f.addAction(WifiManager.RSSI_CHANGED_ACTION); context.registerReceiver(wifiReceiver, f); }
From source file:com.android.tripgenie.auto.MessageReadReceiver.java
@Override public void onReceive(Context context, Intent intent) { Log.d(TAG, "onReceive called"); int conversationId = intent.getIntExtra(CONVERSATION_ID, -1); if (conversationId != -1) { Log.d(TAG, "Conversation " + conversationId + " was read"); NotificationManagerCompat.from(context).cancel(conversationId); }//from ww w . j a va 2 s. co m }
From source file:com.alex.vmandroid.display.spread.advertisement.AdvertisementActivity.java
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_advertisement); Intent intent = getIntent(); int advertisementId = intent.getIntExtra(LoopAdvertisementContract.ADVERTISEMENT_ID, -1); mTitle = intent.getStringExtra(LoopAdvertisementContract.ADVERTISEMENT_TITLE); AdvertisementFragment fragment = AdvertisementFragment.newInstance(advertisementId); new AdvertisementPresenter(fragment, this); FragmentManager fragmentManager = getSupportFragmentManager(); FragmentTransaction transaction = fragmentManager.beginTransaction(); transaction.replace(R.id.advertisement_frame_layout, fragment); transaction.commit();//from www.j a v a 2 s . c om }
From source file:android.support.v17.leanback.app.GuidedStepSupportFragmentTestActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = getIntent(); int layoutDirection = intent.getIntExtra(EXTRA_LAYOUT_DIRECTION, -1); if (layoutDirection != -1) { findViewById(android.R.id.content).setLayoutDirection(layoutDirection); }//from w w w. java 2 s . c om if (savedInstanceState == null) { String firstTestName = intent.getStringExtra(EXTRA_TEST_NAME); if (firstTestName != null) { GuidedStepTestSupportFragment testFragment = new GuidedStepTestSupportFragment(firstTestName); if (intent.getBooleanExtra(EXTRA_ADD_AS_ROOT, true)) { GuidedStepTestSupportFragment.addAsRoot(this, testFragment, android.R.id.content); } else { GuidedStepTestSupportFragment.add(getSupportFragmentManager(), testFragment, android.R.id.content); } } } }
From source file:android.support.v17.leanback.app.SingleSupportFragmentTestActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d(TAG, "onCreate " + this); Intent intent = getIntent(); final int uiOptions = intent.getIntExtra(EXTRA_UI_VISIBILITY, 0); if (uiOptions != 0) { getWindow().getDecorView().setSystemUiVisibility(uiOptions); }//from ww w. j a v a 2 s .c o m setContentView(intent.getIntExtra(EXTRA_ACTIVITY_LAYOUT, R.layout.single_fragment)); if (savedInstanceState == null && findViewById(R.id.main_frame) != null) { try { Fragment fragment = (Fragment) Class.forName(intent.getStringExtra(EXTRA_FRAGMENT_NAME)) .newInstance(); FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.replace(R.id.main_frame, fragment); ft.commit(); } catch (Exception ex) { ex.printStackTrace(); finish(); } } }
From source file:android.support.v17.leanback.app.BrowseSupportFragmentTestActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = getIntent(); BrowseTestSupportFragment.NUM_ROWS = intent.getIntExtra(EXTRA_NUM_ROWS, BrowseTestSupportFragment.DEFAULT_NUM_ROWS); BrowseTestSupportFragment.REPEAT_PER_ROW = intent.getIntExtra(EXTRA_REPEAT_PER_ROW, BrowseTestSupportFragment.DEFAULT_REPEAT_PER_ROW); BrowseTestSupportFragment.LOAD_DATA_DELAY = intent.getLongExtra(EXTRA_LOAD_DATA_DELAY, BrowseTestSupportFragment.DEFAULT_LOAD_DATA_DELAY); BrowseTestSupportFragment.TEST_ENTRANCE_TRANSITION = intent.getBooleanExtra(EXTRA_TEST_ENTRANCE_TRANSITION, BrowseTestSupportFragment.DEFAULT_TEST_ENTRANCE_TRANSITION); setContentView(R.layout.browse);//from w ww .j ava 2 s . co m FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.replace(R.id.main_frame, new BrowseTestSupportFragment()); if (intent.getBooleanExtra(EXTRA_ADD_TO_BACKSTACK, false)) { ft.addToBackStack(null); } ft.commit(); }
From source file:anakiou.com.picontrol.service.EventLogIntentService.java
private void handleGet(Intent intent) { int no = intent.getIntExtra(Constants.EXTRA_NO, 10); List<EventLog> eventLogList = eventLogService.getLatestEvents(no); }
From source file:br.com.virtz.www.cfcmob.MessageReadReceiver.java
@Override public void onReceive(Context context, Intent intent) { if (MyMessagingService.READ_ACTION.equals(intent.getAction())) { int conversationId = intent.getIntExtra(MyMessagingService.CONVERSATION_ID, -1); if (conversationId != -1) { Log.d(TAG, "Conversation " + conversationId + " was read"); NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context); notificationManager.cancel(conversationId); }/* www .ja v a 2 s.c o m*/ } }
From source file:com.insthub.O2OMobile.Activity.D2_OrderHistoryActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.d2_order_history); mBack = (ImageView) findViewById(R.id.top_view_back); mTitle = (TextView) findViewById(R.id.top_view_title); mBack.setOnClickListener(new OnClickListener() { @Override/*from w w w.j av a2s.co m*/ public void onClick(View v) { // TODO Auto-generated method stub finish(); } }); mTitle.setText("??"); Intent intent = getIntent(); mOrderId = intent.getIntExtra("order_id", 0); mTimeLine = findViewById(R.id.d11_order_history_timeline); mListView = (ListView) findViewById(R.id.d11_order_history_list); mOrderHistoryModel = new OrderHistoryModel(this); mOrderHistoryModel.addResponseListener(this); mOrderHistoryModel.get(mOrderId); }