List of usage examples for android.widget ResourceCursorAdapter ResourceCursorAdapter
public ResourceCursorAdapter(Context context, int layout, Cursor c, int flags)
From source file:com.birkettenterprise.phonelocator.activity.UpdateLogActivity.java
@Override public void onCreate(Bundle savedInstanceState) { // add controllers before you call super.onCreate() mListController = new ListController(this); mListController.setContentView(R.layout.update_log_activity); addController(mListController);/*from www .j av a 2 s. com*/ super.onCreate(savedInstanceState); setContentView(mListController.getView()); mResourceCursorAdapter = new ResourceCursorAdapter(UpdateLogActivity.this, R.layout.update_log_list_item, null, true) { @Override public View newView(Context context, Cursor cur, ViewGroup parent) { LayoutInflater li = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); return li.inflate(R.layout.update_log_list_item, parent, false); } @Override public void bindView(View view, Context context, Cursor cursor) { String errorType = cursor.getString(ERROR_TYPE_COLUMN_INDEX); TextView updateTimestampView = (TextView) view.findViewById(R.id.update_log_update_timestamp); setTimeStamp(updateTimestampView, cursor, UPDATE_TIMESTAMP_COLUMN_INDEX); TextView errorView = (TextView) view.findViewById(R.id.update_log_error); if (errorType == null) { TextView locationProviderTextView = (TextView) view .findViewById(R.id.update_log_location_provider); locationProviderTextView.setText(cursor.getString(PROVIDER_COLUMN_INDEX)); errorView.setVisibility(View.GONE); view.findViewById(R.id.update_log_location_provider_layout).setVisibility(View.VISIBLE); } else { errorView.setVisibility(View.VISIBLE); setError(errorView, cursor, errorType); view.findViewById(R.id.update_log_location_provider_layout).setVisibility(View.GONE); } } }; getSupportLoaderManager().initLoader(0, null, this); mListController.setListAdapter(mResourceCursorAdapter); }