Example usage for android.widget SimpleCursorAdapter SimpleCursorAdapter

List of usage examples for android.widget SimpleCursorAdapter SimpleCursorAdapter

Introduction

In this page you can find the example usage for android.widget SimpleCursorAdapter SimpleCursorAdapter.

Prototype

public SimpleCursorAdapter(Context context, int layout, Cursor c, String[] from, int[] to, int flags) 

Source Link

Document

Standard constructor.

Usage

From source file:com.esri.android.mapsapp.MapFragment.java

/**
 * Set the suggestion cursor to an Adapter then set it to the search view
 *///  w  w w  .ja  va2  s . c  o  m
private void applySuggestionCursor() {
    String[] cols = new String[] { COLUMN_NAME_ADDRESS };
    int[] to = new int[] { R.id.suggestion_item_address };

    SimpleCursorAdapter mSuggestionAdapter = new SimpleCursorAdapter(mMapView.getContext(),
            R.layout.search_suggestion_item, mSuggestionCursor, cols, to, 0);
    mSearchview.setSuggestionsAdapter(mSuggestionAdapter);
    mSuggestionAdapter.notifyDataSetChanged();
}

From source file:com.ezac.gliderlogs.FlightOverviewActivity.java

private void fillData() {
    // Must include the _id column for the adapter to work properly
    String[] from = new String[] { GliderLogTables.F_REGISTRATION, GliderLogTables.F_CALLSIGN,
            GliderLogTables.F_TYPE, GliderLogTables.F_INSTRUCTION, GliderLogTables.F_PILOT,
            GliderLogTables.F_COPILOT, GliderLogTables.F_STARTED, GliderLogTables.F_LANDED,
            GliderLogTables.F_DURATION, GliderLogTables.F_LAUNCH, GliderLogTables.F_NOTES };
    // Fields on the UI to which we want to map
    int[] to = new int[] { R.id.label2, R.id.label2a, R.id.label3, R.id.label4, R.id.label5, R.id.label6,
            R.id.label7, R.id.label8, R.id.label9, R.id.label10, R.id.label11 };

    getLoaderManager().initLoader(0, null, this);
    adapter = new SimpleCursorAdapter(this, R.layout.start_row, null, from, to, 0);
    // added to avoid error in case no data in adapter
    Log.d(TAG, "adapter count: " + adapter.getCount());
    //   if (adapter.getCount() > 0) {
    setListAdapter(adapter);/*from   ww w .  j a v  a2  s.c o m*/
    //   }
}