Java Code Examples for android.widget.AdapterView#getItemAtPosition()
The following examples show how to use
android.widget.AdapterView#getItemAtPosition() .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: codeexamples-android File: List7.java License: Eclipse Public License 1.0 | 6 votes |
public void onItemSelected(AdapterView<?> parent, View v, int position, long id) { if (position >= 0) { //Get current cursor Cursor c = (Cursor) parent.getItemAtPosition(position); int type = c.getInt(COLUMN_PHONE_TYPE); String phone = c.getString(COLUMN_PHONE_NUMBER); String label = null; //Custom type? Then get the custom label if (type == Phone.TYPE_CUSTOM) { label = c.getString(COLUMN_PHONE_LABEL); } //Get the readable string String numberType = (String) Phone.getTypeLabel(getResources(), type, label); String text = numberType + ": " + phone; mPhone.setText(text); } }
Example 2
Source Project: filemanager File: FolderFragment.java License: MIT License | 6 votes |
@Override public void onItemClick(AdapterView<?> adapterView, View arg1, int position, long arg3) { Object selectedObject = adapterView.getItemAtPosition(position); if (selectedObject instanceof File) { if (actionMode == null) { File selectedFile = (File) selectedObject; if (selectedFile.isDirectory()) navigateTo(selectedFile); else openFile(selectedFile); } else { toggleFileSelected((File) selectedObject); } } }
Example 3
Source Project: Man-Man File: ManLocalArchiveFragment.java License: GNU General Public License v3.0 | 6 votes |
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { mSearchLocalPage.clearFocus(); // otherwise we have to click "back" twice File data = (File) parent.getItemAtPosition(position); if(data == null) { // header is present, start config tool switch (position) { case 0: // Watch folders showFolderSettingsDialog(); break; case 1: // Download archive downloadArchive(); break; } } else { ManPageDialogFragment mpdf = ManPageDialogFragment.newInstance(data.getName(), data.getPath()); getFragmentManager() .beginTransaction() .addToBackStack("PageFromLocalArchive") .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN) .replace(R.id.replacer, mpdf) .commit(); } }
Example 4
Source Project: fanfouapp-opensource File: SearchResultsPage.java License: Apache License 2.0 | 5 votes |
@Override public boolean onItemLongClick(final AdapterView<?> parent, final View view, final int position, final long id) { final Status s = (Status) parent.getItemAtPosition(position); showPopup(view, s); return true; }
Example 5
Source Project: android-project-wo2b File: BaiduNewsListActivity.java License: Apache License 2.0 | 5 votes |
@Override protected void realOnItemClick(AdapterView<?> parent, View view, int position, long id) { News news = (News) parent.getItemAtPosition(position); Intent intent = new Intent(); intent.setClass(this, BaiduNewsDetailActivity.class); intent.putExtra("news_title", news.getTitle()); intent.putExtra("news_url", news.getUrl()); startActivity(intent); }
Example 6
Source Project: OPFIab File: TrivialActivity.java License: Apache License 2.0 | 5 votes |
@Override public void onItemSelected(final AdapterView<?> parent, final View view, final int position, final long id) { final Helper helper = (Helper) parent.getItemAtPosition(position); if (helper != TrivialBilling.getHelper()) { TrivialBilling.setHelper(helper); startActivity(new Intent(TrivialActivity.this, LauncherActivity.class)); finish(); } }
Example 7
Source Project: android-test File: AdapterViewProtocols.java License: Apache License 2.0 | 5 votes |
@Override public Iterable<AdaptedData> getDataInAdapterView(AdapterView<? extends Adapter> adapterView) { List<AdaptedData> datas = Lists.newArrayList(); for (int i = 0; i < adapterView.getCount(); i++) { int position = i; Object dataAtPosition = adapterView.getItemAtPosition(position); datas.add( new AdaptedData.Builder() .withDataFunction(new StandardDataFunction(dataAtPosition, position)) .withOpaqueToken(position) .build()); } return datas; }
Example 8
Source Project: android-project-wo2b File: SearchActivity.java License: Apache License 2.0 | 5 votes |
@Override protected void realOnItemClick(AdapterView<?> parent, View view, int position, long id) { AlbumInfo albumInfo = (AlbumInfo) parent.getItemAtPosition(position); Intent intent = new Intent(getContext(), ImageGridActivity.class); intent.putExtra(RockyIntent.EXTRA_ALBUM, albumInfo); startActivity(intent); }
Example 9
Source Project: Linphone4Android File: ContactsListFragment.java License: GNU General Public License v3.0 | 5 votes |
@Override public void onItemClick(AdapterView<?> adapter, View view, int position, long id) { LinphoneContact contact = (LinphoneContact) adapter.getItemAtPosition(position); if (editOnClick) { editConsumed = true; LinphoneActivity.instance().editContact(contact, sipAddressToAdd); } else { lastKnownPosition = contactsList.getFirstVisiblePosition(); LinphoneActivity.instance().displayContact(contact, onlyDisplayChatAddress); } }
Example 10
Source Project: Indic-Keyboard File: UserDictionaryAddWordFragment.java License: Apache License 2.0 | 5 votes |
@Override public void onItemSelected(final AdapterView<?> parent, final View view, final int pos, final long id) { final LocaleRenderer locale = (LocaleRenderer)parent.getItemAtPosition(pos); if (locale.isMoreLanguages()) { PreferenceActivity preferenceActivity = (PreferenceActivity)getActivity(); preferenceActivity.startPreferenceFragment(new UserDictionaryLocalePicker(), true); } else { mContents.updateLocale(locale.getLocaleString()); } }
Example 11
Source Project: stynico File: buff_ext.java License: MIT License | 5 votes |
@Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { AppInfo app = (AppInfo) parent.getItemAtPosition(position); Intent intent = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS"); String pkg = "com.android.settings"; String cls = "com.android.settings.applications.InstalledAppDetails"; intent.setComponent(new ComponentName(pkg, cls)); intent.setData(Uri.parse("package:" + app.packageName));//指明要打开的应用 startActivity(intent);// 用普通的方法去打开界面 return true;// 消化掉事件 }
Example 12
Source Project: CSCI4669-Fall15-Android File: ContactListFragment.java License: Apache License 2.0 | 5 votes |
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Contact c = (Contact) parent.getItemAtPosition(position); listener.onContactSelected(c.id); // pass selection to MainActivity }
Example 13
Source Project: FoldableLayout File: MainActivity.java License: Apache License 2.0 | 5 votes |
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { ActivityInfo info = (ActivityInfo) parent.getItemAtPosition(position); Intent intent = new Intent(); intent.setComponent(new ComponentName(this, info.name)); startActivity(intent); }
Example 14
Source Project: BigApp_Discuz_Android File: CitySelectorActivity.java License: Apache License 2.0 | 4 votes |
@Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) { Place p = (Place) adapterView.getItemAtPosition(position); doPlace(p); }
Example 15
Source Project: PMCADemo File: InstallActivity.java License: MIT License | 4 votes |
@Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) { SpkListItem item = (SpkListItem) adapterView.getItemAtPosition(position); installPackage(item.getFile()); }
Example 16
Source Project: dialogflow-android-client File: AITextSampleActivity.java License: Apache License 2.0 | 4 votes |
@Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { final LanguageConfig selectedLanguage = (LanguageConfig) parent.getItemAtPosition(position); initService(selectedLanguage); }
Example 17
Source Project: LiveBlurListView File: BlurActivity.java License: Apache License 2.0 | 4 votes |
@Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { // TODO Auto-generated method stub AppInfo mAppInfo = (AppInfo)arg0.getItemAtPosition(arg2); launch_app(mAppInfo); }
Example 18
Source Project: delion File: NavigationPopup.java License: Apache License 2.0 | 4 votes |
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { NavigationEntry entry = (NavigationEntry) parent.getItemAtPosition(position); mNavigationController.goToNavigationIndex(entry.getIndex()); dismiss(); }
Example 19
Source Project: GravityBox File: StayAwakeTile.java License: Apache License 2.0 | 4 votes |
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { ScreenTimeout st = (ScreenTimeout) parent.getItemAtPosition(position); setScreenOffTimeout(st.mMillis); }
Example 20
Source Project: dialogflow-android-client File: AIServiceSampleActivity.java License: Apache License 2.0 | 4 votes |
@Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { final LanguageConfig selectedLanguage = (LanguageConfig) parent.getItemAtPosition(position); initService(selectedLanguage); }