Java Code Examples for android.widget.ListView#INVALID_POSITION
The following examples show how to use
android.widget.ListView#INVALID_POSITION .
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: BuildmLearn-Toolkit-Android File: MainActivityFragment.java License: BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) { infoListAdapter.swapCursor(cursor); if (mPosition != ListView.INVALID_POSITION) { listView.smoothScrollToPosition(mPosition); } try { TextView info = (TextView) rootView.findViewById(R.id.empty); if (infoListAdapter.getCount() == 0) { info.setText(R.string.list_empty_info); info.setVisibility(View.VISIBLE); } else { info.setVisibility(View.GONE); } } catch (Exception ignored) { } }
Example 2
Source Project: android-discourse File: MainActivity.java License: Apache License 2.0 | 6 votes |
protected void siteChanged(RadioGroup group, int checkedId) { if (checkedId == -1) { return; } RadioButton button = (RadioButton) group.findViewById(checkedId); Site site = (Site) button.getTag(); if (site != null) { App.setSiteUrl(site.getUrl()); } if (site == null) { group.clearCheck(); openSettingsActivity(); } else if (!site.getUrl().equals(mCurrentSiteUrl)) { // TODO 第一次启动 加载上次查看的url。 mDrawerPosition = ListView.INVALID_POSITION; mCurrentSite = site; mCurrentSiteUrl = site.getUrl(); PrefsUtils.setCurrentSiteUrl(mCurrentSiteUrl); App.setLogin(false); clearDatabase(); // 登陆完成后,再加载其他信息 loadUserInfo(site, false); } else { setupUserInfo(mUser); } getActionBar().setSubtitle(mCurrentSiteUrl); }
Example 3
Source Project: UltimateAndroid File: AnimationListFragment.java License: Apache License 2.0 | 5 votes |
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); if (mActivatedPosition != ListView.INVALID_POSITION) { // Serialize and persist the activated item position. outState.putInt(STATE_ACTIVATED_POSITION, mActivatedPosition); } }
Example 4
Source Project: Android-REST-API-Explorer File: SnippetListFragment.java License: MIT License | 5 votes |
private void setActivatedPosition(int position) { if (position == ListView.INVALID_POSITION) { getListView().setItemChecked(mActivatedPosition, false); } else { getListView().setItemChecked(position, true); } mActivatedPosition = position; }
Example 5
Source Project: endpoints-codelab-android File: SwipeDismissList.java License: GNU General Public License v3.0 | 5 votes |
private void resetSwipeState() { if (mVelocityTracker != null) { mVelocityTracker.recycle(); } mVelocityTracker = null; mDownX = 0; mDownY = 0; mDownView = null; mDownPosition = ListView.INVALID_POSITION; mSwiping = false; }
Example 6
Source Project: Android-REST-API-Explorer File: SnippetListFragment.java License: MIT License | 5 votes |
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); if (mActivatedPosition != ListView.INVALID_POSITION) { // Serialize and persist the activated item position. outState.putInt(STATE_ACTIVATED_POSITION, mActivatedPosition); } }
Example 7
Source Project: android File: ListadoRestaurantes.java License: GNU General Public License v2.0 | 5 votes |
public void onItemClick(AdapterView<?> arg0, View view, int posicion, long id) { if (posicion == ListView.INVALID_POSITION) return; Restaurante restaurante = listaRestaurantes.get(posicion); Intent i = new Intent(this, Mapa.class); i.putExtra("latitud", restaurante.getLatitud()); i.putExtra("longitud", restaurante.getLongitud()); i.putExtra("nombre", restaurante.getNombre()); startActivity(i); }
Example 8
Source Project: travelguide File: ArticleInfoListFragment.java License: Apache License 2.0 | 5 votes |
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); if (mActivatedPosition != ListView.INVALID_POSITION) outState.putInt(STATE_ACTIVATED_POSITION, mActivatedPosition); }
Example 9
Source Project: container File: ResolverActivity.java License: GNU General Public License v3.0 | 5 votes |
@Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); if (mAlwaysUseOption) { final int checkedPos = mListView.getCheckedItemPosition(); final boolean enabled = checkedPos != ListView.INVALID_POSITION; mLastSelected = checkedPos; mAlwaysButton.setEnabled(enabled); mOnceButton.setEnabled(enabled); if (enabled) { mListView.setSelection(checkedPos); } } }
Example 10
Source Project: Gazetti_Newspaper_Reader File: WebsiteListFragment.java License: MIT License | 5 votes |
private void setActivatedPosition(int position) { // //Log.d(TAG, "ListFragment SETACTIVATED"); if (position == ListView.INVALID_POSITION) { mListView.setItemChecked(mActivatedPosition, false); } else { mListView.setItemChecked(position, true); } mActivatedPosition = position; }
Example 11
Source Project: climb-tracker File: ClimbSessionListFragment.java License: Apache License 2.0 | 5 votes |
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); if (mActivatedPosition != ListView.INVALID_POSITION) { // Serialize and persist the activated item position. outState.putInt(STATE_ACTIVATED_POSITION, mActivatedPosition); } }
Example 12
Source Project: android File: GuiaRestaurantes.java License: GNU General Public License v2.0 | 5 votes |
public void onItemClick(AdapterView<?> arg0, View view, int posicion, long id) { if (posicion == ListView.INVALID_POSITION) return; Restaurante restaurante = listaRestaurantes.get(posicion); Intent i = new Intent(this, Mapa.class); i.putExtra("latitud", restaurante.getLatitud()); i.putExtra("longitud", restaurante.getLongitud()); i.putExtra("nombre", restaurante.getNombre()); startActivity(i); }
Example 13
Source Project: restcomm-android-sdk File: MainFragment.java License: GNU Affero General Public License v3.0 | 5 votes |
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); if (mActivatedPosition != ListView.INVALID_POSITION) { // Serialize and persist the activated item position. outState.putInt(STATE_ACTIVATED_POSITION, mActivatedPosition); } }
Example 14
Source Project: pixate-freestyle-android File: ViewListFragment.java License: Apache License 2.0 | 5 votes |
private void setActivatedPosition(int position) { if (position == ListView.INVALID_POSITION) { getListView().setItemChecked(mActivatedPosition, false); } else { getListView().setItemChecked(position, true); } mActivatedPosition = position; }
Example 15
Source Project: UltimateAndroid File: AnimationListFragment.java License: Apache License 2.0 | 5 votes |
private void setActivatedPosition(int position) { if (position == ListView.INVALID_POSITION) { getListView().setItemChecked(mActivatedPosition, false); } else { getListView().setItemChecked(position, true); } mActivatedPosition = position; }
Example 16
Source Project: BuildmLearn-Toolkit-Android File: MainActivityFragment.java License: BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void onSaveInstanceState(Bundle outState) { outState.putParcelableArrayList("infoList", infoList); if (mPosition != ListView.INVALID_POSITION) { outState.putInt(SELECTED_KEY, mPosition); } super.onSaveInstanceState(outState); }
Example 17
Source Project: iBeebo File: BrowserWeiboMsgCommentAndRepostAdapter.java License: GNU General Public License v3.0 | 5 votes |
private ViewHolder getViewHolderByView(View view) { try { final int position = listView.getPositionForView(view); if (position == ListView.INVALID_POSITION) { return null; } return getViewHolderByView(position); } catch (NullPointerException e) { } return null; }
Example 18
Source Project: UltimateRecyclerView File: SwipeListView.java License: Apache License 2.0 | 4 votes |
/** * Notifies onClickBackView * * @param position back item clicked */ protected void onClickBackView(int position) { if (swipeListViewListener != null && position != ListView.INVALID_POSITION) { swipeListViewListener.onClickBackView(position); } }
Example 19
Source Project: UltimateRecyclerView File: SwipeListView.java License: Apache License 2.0 | 4 votes |
protected int changeSwipeMode(int position) { if (swipeListViewListener != null && position != ListView.INVALID_POSITION) { return swipeListViewListener.onChangeSwipeMode(position); } return SWIPE_MODE_DEFAULT; }
Example 20
Source Project: UltimateRecyclerView File: SwipeListView.java License: Apache License 2.0 | 2 votes |
/** * Start close item * * @param position list item * @param right na */ protected void onStartClose(int position, boolean right) { if (swipeListViewListener != null && position != ListView.INVALID_POSITION) { swipeListViewListener.onStartClose(position, right); } }