List of usage examples for android.support.v4.widget CursorAdapter FLAG_AUTO_REQUERY
int FLAG_AUTO_REQUERY
To view the source code for android.support.v4.widget CursorAdapter FLAG_AUTO_REQUERY.
Click Source Link
From source file:nl.basvanmarwijk.mylocations.viewcontroller.LocationItemListFragment.java
@SuppressLint("InflateParams") @Override/* ww w . j av a 2 s . c o m*/ public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); //TODO other constructor flag adapter = new LocationItemCursorAdapter(App.getAppContext(), App.getDbManager().getAllColumnsCursor(), CursorAdapter.FLAG_AUTO_REQUERY); final View btn_add = getActivity().getLayoutInflater().inflate(R.layout.add_button, null); final ListView lv = getListView(); lv.addHeaderView(btn_add); btn_add.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { LocationBridge lb = new LocationBridge(getActivity().getApplicationContext()); final String TAG = ((Object) this).getClass().getName(); Log.i(TAG, "start locatie zoeken"); Location locatie = null; try { locatie = lb.getLastLocation(); } catch (LocationException e) { Log.w(TAG, e.getMessage()); } finally { lb.close(); } if (locatie != null) { Toast.makeText(getActivity(), R.string.location_found, Toast.LENGTH_SHORT).show(); toggleProgressBar(true); PlaceDownloaderTask downloader = new PlaceDownloaderTask(new PlaceDownloaderListener()); downloader.execute(locatie); } else { Toast.makeText(getActivity(), R.string.location_not_available, Toast.LENGTH_LONG).show(); } } }); setListAdapter(adapter); }
From source file:de.eidottermihi.rpicheck.activity.CustomCommandActivity.java
/** * Init ListView with commands./*from ww w .ja va 2s. c o m*/ * * @param pi */ private void initListView(RaspberryDeviceBean pi) { new AsyncTask<Void, Void, Void>() { @Override protected Void doInBackground(Void... params) { fullCommandCursor = deviceDb.getFullCommandCursor(); return null; } @Override protected void onPostExecute(Void r) { CommandAdapter commandsAdapter = new CommandAdapter(CustomCommandActivity.this, fullCommandCursor, CursorAdapter.FLAG_AUTO_REQUERY); commandListView.setAdapter(commandsAdapter); commandListView.setOnItemClickListener(CustomCommandActivity.this); // commandListView.setOnItemLongClickListener(CustomCommandActivity.this); registerForContextMenu(commandListView); } }.execute(); }