List of usage examples for android.content Intent getIntExtra
public int getIntExtra(String name, int defaultValue)
From source file:com.kiddobloom.bucketlist.DetailedEntryActivity.java
/** * {@inheritDoc}//from www. j a va2 s .c o m */ @Override public void onCreate(Bundle icicle) { Intent intent = getIntent(); bucketListTab = intent.getIntExtra("com.kiddobloom.bucketlist.current_tab", 0); facebook_id = intent.getStringExtra("com.kiddobloom.bucketlist.facebook_id"); //Log.d("tagaa", "DetailedEntry activity oncreate - bucketListTab: " + bucketListTab + " facebook: " + facebook_id); super.onCreate(icicle); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); getActionBar().setTitle("Bucket List"); getActionBar().setSubtitle("by kiddoBLOOM"); // getActionBar().setDisplayHomeAsUpEnabled(true); sp = getSharedPreferences(getString(R.string.pref_name), MODE_PRIVATE); myApp = (MyApplication) getApplication(); list = new ArrayList<BucketListTable>(); }
From source file:com.example.activity.ProfileActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.profile_list); title = (TextView) findViewById(R.id.topview_title); back = (ImageView) findViewById(R.id.topview_back); listView = (ListView) findViewById(R.id.profile_shots_list); Intent intent = getIntent(); playerId = intent.getIntExtra(PLAYER_ID, 1); title.setText(""); back.setVisibility(View.VISIBLE); back.setOnClickListener(this); headView = LayoutInflater.from(this).inflate(R.layout.profile, null); bottomView = LayoutInflater.from(this).inflate(R.layout.profile_bottom, null); head = (ImageView) headView.findViewById(R.id.profile_head); name = (TextView) headView.findViewById(R.id.profile_name); location = (TextView) headView.findViewById(R.id.profile_location); net = (TextView) headView.findViewById(R.id.profile_net); shots_count = (TextView) headView.findViewById(R.id.profile_shots_count); likes_count = (TextView) headView.findViewById(R.id.profile_likes_count); following_count = (TextView) headView.findViewById(R.id.profile_following_count); followers_count = (TextView) headView.findViewById(R.id.profile_followers_count); shots_view = (LinearLayout) headView.findViewById(R.id.profile_shots_view); likes_view = (LinearLayout) headView.findViewById(R.id.profile_likes_view); following_view = (LinearLayout) headView.findViewById(R.id.profile_following_view); followers_view = (LinearLayout) headView.findViewById(R.id.profile_followers_view); more = (LinearLayout) bottomView.findViewById(R.id.profile_bottom_more); LayoutParams params = head.getLayoutParams(); params.width = getWindowManager().getDefaultDisplay().getWidth() / 4; params.height = params.width;//from w w w . j ava 2 s .c om head.setLayoutParams(params); listView.addHeaderView(headView); listView.addFooterView(bottomView); head.setOnClickListener(this); shots_view.setOnClickListener(this); likes_view.setOnClickListener(this); following_view.setOnClickListener(this); followers_view.setOnClickListener(this); more.setOnClickListener(this); playerModel = new PlayerModel(this); playerModel.addResponseListener(this); playerModel.getPlayer(playerId); playerModel.getProfileShotList(playerId); }
From source file:com.daiv.android.twitter.services.SendScheduledTweet.java
@Override public void onHandleIntent(Intent intent) { Log.v("Test_scheduled_tweet", "started service"); final String text = intent.getStringExtra(EXTRA_TEXT); final int account = intent.getIntExtra("account", 1); final int alarmId = intent.getIntExtra("alarm_id", 0); final Context context = this; final AppSettings settings = AppSettings.getInstance(context); new Thread(new Runnable() { @Override/* ww w .j a v a 2s .com*/ public void run() { sendingNotification(); boolean sent = sendTweet(settings, context, text, account); if (sent) { finishedTweetingNotification(); QueuedDataSource.getInstance(context).deleteScheduledTweet(alarmId); } else { makeFailedNotification(text, settings); } } }).start(); }
From source file:com.crowflying.buildwatch.smartwatch.BuildWatchExtensionService.java
@Override protected void onViewEvent(Intent intent) { IntentUtils.printIntentExtras(intent); int eventId = intent.getIntExtra(Notification.Intents.EXTRA_EVENT_ID, -1); Cursor cursor = getContentResolver().query(Notification.Event.URI, null, Notification.EventColumns._ID + " = ?", new String[] { "" + eventId }, null); if (cursor != null && cursor.moveToFirst()) { String url = cursor.getString(cursor.getColumnIndex(Notification.EventColumns.FRIEND_KEY)); Intent browse = new Intent(Intent.ACTION_VIEW); browse.setData(Uri.parse(url));/*w w w . jav a 2 s. c o m*/ browse.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(browse); } }
From source file:com.a_login.registration.IWantWalletFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = getActivity().getIntent(); if (intent != null) { mItemId = intent.getIntExtra(Constants.EXTRA_ITEM_ID, 0); }//from www . ja v a2s . co m setRetainInstance(true); String accountName = ((IWantApplication) getActivity().getApplication()).getAccountName(); // Set up a wallet client mWalletClient = new WalletClient(getActivity(), Constants.WALLET_ENVIRONMENT, accountName, WalletConstants.THEME_HOLO_LIGHT, this, this); mRetryHandler = new RetryHandler(this); }
From source file:de.Maxr1998.xposed.maxlock.ui.ThemeService.java
@Override protected void onHandleIntent(Intent intent) { Log.d("MaxLock/ThemeService", "Intent received"); themeFile = new File(Util.dataDir(this) + File.separator + "shared_prefs" + File.separator + themeOrigFile); int extra = intent.getIntExtra("extra", -1); switch (extra) { case 1:/*from w w w . j a v a2s . c o m*/ importTheme(intent.getStringExtra("package")); break; case 2: clearUp(); break; } }
From source file:fr.inria.ucn.collectors.SysStateCollector.java
/** * //from www . j a v a2s . c o m * @param c * @param ts * @param change */ @SuppressLint("NewApi") public void run(Context c, long ts, boolean change) { try { JSONObject data = new JSONObject(); data.put("on_screen_state_change", change); // this collection run was triggered by screen state change data.put("hostname", Helpers.getSystemProperty("net.hostname", "unknown hostname")); data.put("current_timezone", Time.getCurrentTimezone()); // general memory state ActivityManager am = (ActivityManager) c.getSystemService(Context.ACTIVITY_SERVICE); MemoryInfo mi = new MemoryInfo(); am.getMemoryInfo(mi); JSONObject mem = new JSONObject(); mem.put("available", mi.availMem); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) { mem.put("total", mi.totalMem); } mem.put("is_low", mi.lowMemory); data.put("memory", mem); // screen state PowerManager pm = (PowerManager) c.getSystemService(Context.POWER_SERVICE); data.put("screen_on", pm.isScreenOn()); // battery state IntentFilter ifilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED); Intent battery = c.registerReceiver(null, ifilter); int level = battery.getIntExtra(BatteryManager.EXTRA_LEVEL, -1); int scale = battery.getIntExtra(BatteryManager.EXTRA_SCALE, -1); float pct = (float) (100.0 * level) / scale; int status = battery.getIntExtra(BatteryManager.EXTRA_STATUS, -1); boolean isCharging = (status == BatteryManager.BATTERY_STATUS_CHARGING || status == BatteryManager.BATTERY_STATUS_FULL); int chargePlug = battery.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1); boolean usbCharge = chargePlug == BatteryManager.BATTERY_PLUGGED_USB; boolean acCharge = chargePlug == BatteryManager.BATTERY_PLUGGED_AC; JSONObject batt = new JSONObject(); batt.put("level", level); batt.put("scale", scale); batt.put("pct", pct); batt.put("is_charging", isCharging); batt.put("usb_charge", usbCharge); batt.put("ac_charge", acCharge); data.put("battery", batt); // some proc stats data.put("cpu", getCpuStat()); data.put("loadavg", getLoadStat()); data.put("uptime", getUptimeStat()); // audio state data.put("audio", getAudioState(c)); // done Helpers.sendResultObj(c, "system_state", ts, data); } catch (JSONException jex) { Log.w(Constants.LOGTAG, "failed to create json object", jex); } }
From source file:com.amsterdam.marktbureau.makkelijkemarkt.VervangerDialogActivity.java
/** * * @param savedInstanceState//from w w w . ja v a 2 s . co m */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // set the nfc scan layout setContentView(R.layout.vervanger_dialog_activity); // bind the elements to the view ButterKnife.bind(this); // get the vervanger id from the activity intent Intent intent = getIntent(); if ((intent != null) && (intent.hasExtra(DagvergunningFragmentKoopman.VERVANGER_INTENT_EXTRA_VERVANGER_ID))) { int vervangerId = intent.getIntExtra(DagvergunningFragmentKoopman.VERVANGER_INTENT_EXTRA_VERVANGER_ID, 0); if (vervangerId != 0) { mVervangerId = vervangerId; } } // create an adapter for the koopmannen listview mKoopmannenAdapter = new VervangerKoopmannenAdapter(this); mKoopmannenListView.setAdapter(mKoopmannenAdapter); // inititate loading the dagvergunningen from the database with the given koopman id getSupportLoaderManager().initLoader(KOOPMANNEN_LOADER, null, this); // disable upper-casing the wizard menu buttons mCancelButton.setTransformationMethod(null); }
From source file:com.bulletingroupblast.bulletingroupblast.OrganizationActivity.java
/** The activty create event * * @param savedInstanceState bundle//w w w . j av a 2s .c o m */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_organization); GlobalState gs = (GlobalState) getApplicationContext(); // Global Variables User currentUser = gs.getCurrentUser(); mNavigationOrganizationDrawerFragment = (NavigationOrganizationDrawerFragment) getSupportFragmentManager() .findFragmentById(R.id.organization_navigation_drawer); mTitle = getTitle(); // Set up the drawer. mNavigationOrganizationDrawerFragment.setUp(R.id.organization_navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout)); // Get the organization information Intent intent = getIntent(); // Get the values that were passed through the intent mOrgId = intent.getIntExtra(UserLandingActivity.ORG_ID, 0); mOrganization = gs.getCurrentUser().getOrganizationById(mOrgId); // Get the organization mTitle = String.valueOf(mOrganization.getName()); // Set the tile // Load the title array mTitleList = new String[] { getString(R.string.title_overview), getString(R.string.title_groups), getString(R.string.title_news), getString(R.string.title_events), getString(R.string.title_calendar), getString(R.string.title_users) }; // Load the organization data }
From source file:gov.nasa.arc.geocam.geocam.CameraPreviewActivity.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == PICK_ICON_REQUEST) { if (resultCode == RESULT_OK) { int icon_id = data.getIntExtra(FireIconActivity.EXTRA_ID, R.drawable.fire_icon_default); mImageTag = data.getStringExtra(FireIconActivity.EXTRA_TAG); mFireButton.setImageDrawable(getResources().getDrawable(icon_id)); }//from w w w.j av a 2 s .c o m } }