List of usage examples for android.widget AdapterView getId
@IdRes @ViewDebug.CapturedViewProperty public int getId()
From source file:edu.mit.mobile.android.demomode.DemoMode.java
@Override public void onItemClick(AdapterView<?> adapter, View v, int position, long id) { switch (adapter.getId()) { case R.id.grid: { final Intent launch = new Intent(); final Cursor c = mAdapter.getCursor(); launch.setClassName(c.getString(c.getColumnIndex(LauncherItem.PACKAGE_NAME)), c.getString(c.getColumnIndex(LauncherItem.ACTIVITY_NAME))); launch.addFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(launch);//w w w. j ava 2 s .c o m } break; case R.id.all_apps: { final ApplicationInfo appInfo = (ApplicationInfo) mAllApps.getAdapter().getItem(position); startActivity(appInfo.intent); } break; } }
From source file:com.massivcode.androidmusicplayer.activities.MainActivity.java
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { switch (parent.getId()) { // Songs ListView ? : ? case R.id.songs_listView: { ArrayList<Long> list = (ArrayList) MusicInfoLoadUtil.getSelectedSongPlaylist(MainActivity.this, (Cursor) parent.getAdapter().getItem(position)); Intent intent = new Intent(MainActivity.this, MusicService.class); intent.setAction(MusicService.ACTION_PLAY); intent.putExtra("list", list); intent.putExtra("position", 0); startService(intent);//from w w w . jav a2 s . co m break; } // ??? ? : ?? ? case R.id.current_playlistView: { Intent intent = new Intent(MainActivity.this, MusicService.class); intent.setAction(MusicService.ACTION_PLAY_SELECTED); intent.putExtra("position", position); startService(intent); break; } } }
From source file:edu.mit.mobile.android.demomode.DemoMode.java
@Override public boolean onItemLongClick(AdapterView<?> adapter, View v, int position, long id) { switch (adapter.getId()) { case R.id.grid: { if (!mLocked) { getContentResolver().delete(ContentUris.withAppendedId(LauncherItem.CONTENT_URI, id), null, null); return true; }/* www .j a v a 2 s. c o m*/ } break; case R.id.all_apps: { final ApplicationInfo appInfo = (ApplicationInfo) mAllApps.getItemAtPosition(position); final ContentValues cv = new ContentValues(); final ComponentName c = appInfo.intent.getComponent(); cv.put(LauncherItem.ACTIVITY_NAME, c.getClassName()); cv.put(LauncherItem.PACKAGE_NAME, c.getPackageName()); getContentResolver().insert(LauncherItem.CONTENT_URI, cv); mDrawer.close(); return true; } } return false; }
From source file:li.barter.fragments.ChatsFragment.java
@Override public void onItemClick(final AdapterView<?> parent, final View view, final int position, final long id) { if (parent.getId() == R.id.list_chats) { final Cursor cursor = (Cursor) mChatsAdapter.getItem(position); loadChat(cursor.getString(cursor.getColumnIndex(DatabaseColumns.USER_ID)), cursor.getString(cursor.getColumnIndex(DatabaseColumns.CHAT_ID)), true, null); }//from w w w . j a v a 2s .c om }
From source file:com.kiwiteam.nomiddleman.LargeGroupActivity.java
@Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { int vId = parent.getId(); switch (vId) { case R.id.day: String day = parent.getItemAtPosition(position).toString(); ArrayList<Integer> quantities = tour.getAllTourSessionAvailability(day); tQty = (Spinner) findViewById(R.id.quantity); qAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, quantities); qAdapter.notifyDataSetChanged(); qAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); tQty.setAdapter(qAdapter);/*from w w w.j av a 2s .co m*/ break; } }
From source file:com.z299studio.pb.EditFragment.java
@Override public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) { if (parent.getId() == R.id.category) { mPosition = pos;/*from ww w. j ava2 s .c o m*/ } else { EntryHolder eh = (EntryHolder) parent.getTag(); int type = pos + 1; eh.mEntryItem.mType = type; eh.mValueField.setInputType(INPUT_TYPES[type]); if (type == AccountManager.EntryType.PASSWORD || type == AccountManager.EntryType.PIN) { eh.mAutoPwd.setVisibility(View.VISIBLE); } else { eh.mAutoPwd.setVisibility(View.INVISIBLE); } } }
From source file:com.javadog.bluetoothproximitylock.BluetoothFragment.java
@Override public void onItemSelected(AdapterView<?> adapterView, View view, int position, long rowId) { SharedPreferences.Editor prefsEditor = userPrefs.edit(); switch (adapterView.getId()) { case R.id.bt_device_chooser: //Feed the selected device's address to BluetoothManager Set<BluetoothDevice> devicesSet = BluetoothManager.getAllBtDevices(); BluetoothDevice chosenDevice = (BluetoothDevice) devicesSet.toArray()[position]; BluetoothManager.setSelectedDevice(chosenDevice); //Update saved preference prefsEditor.putString(BluetoothFragment.PREF_BT_DEVICE_ADDRESS, chosenDevice.getAddress()); break;//from w w w . j a v a2 s.com case R.id.bt_lock_distances: //Update saved preference prefsEditor.putInt(PREF_LOCK_DISTANCE, lockDistance.getSelectedItemPosition()); break; case R.id.bt_refresh_interval: //Save the spinner value into our instance variable here refreshInterval = interpretRefreshSpinner(refreshIntervalSpinner.getSelectedItemPosition()); //Update saved preference prefsEditor.putInt(PREF_REFRESH_INTERVAL, refreshIntervalSpinner.getSelectedItemPosition()); break; } prefsEditor.apply(); //Call startService again (if the service is running) in order to update its settings based on new prefs. if (serviceBound) { startBtService(); } }
From source file:com.binomed.showtime.android.screen.search.CineShowTimeSearchFragment.java
@Override public void onItemSelected(AdapterView<?> adapter, View view, int groupPositon, long id) { if (adapter.getId() == R.id.searchSpinner) { model.setDay(groupPositon);//from w w w.j ava2 s.c o m } }
From source file:gov.wa.wsdot.android.wsdot.ui.ferries.departures.FerriesRouteSchedulesDayDeparturesActivity.java
/** * Callback for spinners. Gets the terminal item for the selected day and * requests the departure times for that day from the view model. *//*from ww w. j ava 2 s.c om*/ public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { Boolean shouldUpdate; switch (parent.getId()) { case FerriesRouteSchedulesDayDeparturesActivity.SAILING_SPINNER_ID: shouldUpdate = mTerminalIndex != position; mTerminalIndex = position; break; case FerriesRouteSchedulesDayDeparturesActivity.DAY_SPINNER_ID: shouldUpdate = mDayIndex != position; mDayIndex = position; break; default: shouldUpdate = false; } // Don't bother updating the terminal if we didn't select anything new if (shouldUpdate) { mTerminalItem = mScheduleDateItems.get(mDayIndex).getFerriesTerminalItem().get(mTerminalIndex); terminalViewModel.setScrollToCurrent(true); terminalViewModel.loadDepartureTimesForTerminal(mTerminalItem); terminalCameraViewModel.loadTerminalCameras(mTerminalItem.getDepartingTerminalID(), "ferries"); } }
From source file:com.tcl.lzhang1.mymusic.ui.MainActivity.java
@Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { // TODO Auto-generated method stub Bundle bundle = null;//from w w w. j a v a 2 s. com switch (arg0.getId()) { case R.id.mine_list: // menu list { if (isRefreshing) { UIHelper.toast(this, R.string.refreshing_music_stand_by); return; } HashMap<String, String> map = mList.get(arg2); String name = map.get("name"); if (getString(R.string.local_music).equals(name)) { bundle = new Bundle(); bundle.putInt("startmode", MusicListAcitivity.START_MODE_LOCAL); bundle.putSerializable("songs", new SongsWrap(mSongModels)); UIHelper.showMusicListActivity(this, bundle); bundle = null; } else if (getString(R.string.fav_music).equals(name)) { bundle = new Bundle(); bundle.putInt("startmode", MusicListAcitivity.START_MODE_FAV); bundle.putSerializable("songs", new SongsWrap(mSongModels)); UIHelper.showMusicListActivity(this, bundle); bundle = null; } } break; default: break; } }