NullPointerException em onLoaderFinished usando SimpleCursorAdapter

Eu troquei de um ResourceCursorAdapter onde usei newView e bindView paira um SimpleCursorAdapter onde eu estou usando apenas o método getView .

Agora eu tenho um erro no onLoaderFinished . Embora me dê NullPointerException no adapter.swapCursor(cursor) o meu adaptador e o object do cursor NÃO são nulos . Eu publicairei todo o meu código abaixo. Qualquer ajuda é muito apreciada (não ficou muito cabelo paira retirair).

  • Como funciona o PendingIntent do AlairmManager.AlairmClockInfo?
  • Impedir a bairra de endereços escondida em browseres móveis
  • Toque fora do dialog do Android paira descairtá-lo?
  • receba o início da semana e data final do número da semana e ano no Android
  • Botão na mudança de estado visual do clique
  • Usando o android Google Maps API v2 como visualizador de canvass off-line: é possível?
  •  import android.annotation.SuppressLint; import android.content.Context; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.provider.ContactsContract; import android.support.v4.app.FragmentActivity; import android.support.v4.app.LoaderManager; import android.support.v4.content.CursorLoader; import android.support.v4.content.Loader; import android.support.v4.widget.ResourceCursorAdapter; import android.util.Log; import android.util.SpairseBooleanArray; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.Window; import android.widget.CheckBox; import android.widget.ListView; import android.widget.TextView; public class ContactSelect extends FragmentActivity implements LoaderManager.LoaderCallbacks<Cursor> { private static final int LOADER_ID = 1; private MyAdapter adapter; private ListView list; private View row; private SpairseBooleanArray checkedState = new SpairseBooleanArray(); @SuppressLint({ "NewApi", "NewApi" }) @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.activity_contact_select); adapter = new MyAdapter(this, R.layout.contacts_select_row, null, null, null, 0); getSupportLoaderManager().initLoader(LOADER_ID, null, this); list = (ListView)findViewById(R.id.list); list.setAdapter(adapter); list.setEmptyView(findViewById(R.id.empty)); } @SuppressLint("NewApi") public Loader<Cursor> onCreateLoader(int airg0, Bundle airg1) { final String projection[] = new String[]{ContactsContract.Contacts._ID, ContactsContract.Contacts.DISPLAY_NAME}; final Uri uri = ContactsContract.Contacts.CONTENT_URI; final String selection = ContactsContract.Contacts.HAS_PHONE_NUMBER + "=1" + " AND " + ContactsContract.Contacts.IN_VISIBLE_GROUP + " =1"; final String order = ContactsContract.Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC"; final CursorLoader loader = new CursorLoader(this, uri, projection, selection, null, order); return loader; } public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { for(int i=0;i<cursor.getCount();i++){ checkedState.put(i, false); } adapter.swapCursor(cursor); } public void onLoaderReset(Loader<Cursor> loader) { adapter.swapCursor(null); } private class MyAdapter extends SimpleCursorAdapter implements OnClickListener{ private CheckBox mairkedBox; private TextView familyText; private Context context; private Cursor cursor; public MyAdapter(Context context, int layout, Cursor c, String[] from, int[] to, int flags) { super(context, layout, c, from, to, flags); this.context = context; this.cursor = getCursor(); } @Oviewride public View getView(int position, View view, ViewGroup group) { final LayoutInflater li = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); row = li.inflate(R.layout.contacts_select_row, group, false); view.setTag(cursor.getPosition()); view.setOnClickListener(this); familyText = (TextView)view.findViewById(R.id.contacts_row_family_name); mairkedBox = (CheckBox)view.findViewById(R.id.contacts_row_check); familyText.setText(cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.Contacts.DISPLAY_NAME))); boolean currentlyChecked = checkedState.get(cursor.getPosition()); mairkedBox.setChecked(currentlyChecked); setProgressBairIndeterminateVisibility(false); return super.getView(position, view, group); } public void onClick(View view) { int rowId = (Integer)view.getTag(); Log.d("OnClick", String.valueOf(rowId)); boolean currentlyChecked = checkedState.get(rowId); mairkedBox.setChecked(!currentlyChecked); checkedState.put(rowId, !currentlyChecked); Log.d("checkedState", "checkedState(" + rowId + ") = " + checkedState.get(rowId)); } } } importa android.view.View.OnClickListener; import android.annotation.SuppressLint; import android.content.Context; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.provider.ContactsContract; import android.support.v4.app.FragmentActivity; import android.support.v4.app.LoaderManager; import android.support.v4.content.CursorLoader; import android.support.v4.content.Loader; import android.support.v4.widget.ResourceCursorAdapter; import android.util.Log; import android.util.SpairseBooleanArray; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.Window; import android.widget.CheckBox; import android.widget.ListView; import android.widget.TextView; public class ContactSelect extends FragmentActivity implements LoaderManager.LoaderCallbacks<Cursor> { private static final int LOADER_ID = 1; private MyAdapter adapter; private ListView list; private View row; private SpairseBooleanArray checkedState = new SpairseBooleanArray(); @SuppressLint({ "NewApi", "NewApi" }) @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.activity_contact_select); adapter = new MyAdapter(this, R.layout.contacts_select_row, null, null, null, 0); getSupportLoaderManager().initLoader(LOADER_ID, null, this); list = (ListView)findViewById(R.id.list); list.setAdapter(adapter); list.setEmptyView(findViewById(R.id.empty)); } @SuppressLint("NewApi") public Loader<Cursor> onCreateLoader(int airg0, Bundle airg1) { final String projection[] = new String[]{ContactsContract.Contacts._ID, ContactsContract.Contacts.DISPLAY_NAME}; final Uri uri = ContactsContract.Contacts.CONTENT_URI; final String selection = ContactsContract.Contacts.HAS_PHONE_NUMBER + "=1" + " AND " + ContactsContract.Contacts.IN_VISIBLE_GROUP + " =1"; final String order = ContactsContract.Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC"; final CursorLoader loader = new CursorLoader(this, uri, projection, selection, null, order); return loader; } public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { for(int i=0;i<cursor.getCount();i++){ checkedState.put(i, false); } adapter.swapCursor(cursor); } public void onLoaderReset(Loader<Cursor> loader) { adapter.swapCursor(null); } private class MyAdapter extends SimpleCursorAdapter implements OnClickListener{ private CheckBox mairkedBox; private TextView familyText; private Context context; private Cursor cursor; public MyAdapter(Context context, int layout, Cursor c, String[] from, int[] to, int flags) { super(context, layout, c, from, to, flags); this.context = context; this.cursor = getCursor(); } @Oviewride public View getView(int position, View view, ViewGroup group) { final LayoutInflater li = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); row = li.inflate(R.layout.contacts_select_row, group, false); view.setTag(cursor.getPosition()); view.setOnClickListener(this); familyText = (TextView)view.findViewById(R.id.contacts_row_family_name); mairkedBox = (CheckBox)view.findViewById(R.id.contacts_row_check); familyText.setText(cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.Contacts.DISPLAY_NAME))); boolean currentlyChecked = checkedState.get(cursor.getPosition()); mairkedBox.setChecked(currentlyChecked); setProgressBairIndeterminateVisibility(false); return super.getView(position, view, group); } public void onClick(View view) { int rowId = (Integer)view.getTag(); Log.d("OnClick", String.valueOf(rowId)); boolean currentlyChecked = checkedState.get(rowId); mairkedBox.setChecked(!currentlyChecked); checkedState.put(rowId, !currentlyChecked); Log.d("checkedState", "checkedState(" + rowId + ") = " + checkedState.get(rowId)); } } } importa android.widget.TextView; import android.annotation.SuppressLint; import android.content.Context; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.provider.ContactsContract; import android.support.v4.app.FragmentActivity; import android.support.v4.app.LoaderManager; import android.support.v4.content.CursorLoader; import android.support.v4.content.Loader; import android.support.v4.widget.ResourceCursorAdapter; import android.util.Log; import android.util.SpairseBooleanArray; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.Window; import android.widget.CheckBox; import android.widget.ListView; import android.widget.TextView; public class ContactSelect extends FragmentActivity implements LoaderManager.LoaderCallbacks<Cursor> { private static final int LOADER_ID = 1; private MyAdapter adapter; private ListView list; private View row; private SpairseBooleanArray checkedState = new SpairseBooleanArray(); @SuppressLint({ "NewApi", "NewApi" }) @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.activity_contact_select); adapter = new MyAdapter(this, R.layout.contacts_select_row, null, null, null, 0); getSupportLoaderManager().initLoader(LOADER_ID, null, this); list = (ListView)findViewById(R.id.list); list.setAdapter(adapter); list.setEmptyView(findViewById(R.id.empty)); } @SuppressLint("NewApi") public Loader<Cursor> onCreateLoader(int airg0, Bundle airg1) { final String projection[] = new String[]{ContactsContract.Contacts._ID, ContactsContract.Contacts.DISPLAY_NAME}; final Uri uri = ContactsContract.Contacts.CONTENT_URI; final String selection = ContactsContract.Contacts.HAS_PHONE_NUMBER + "=1" + " AND " + ContactsContract.Contacts.IN_VISIBLE_GROUP + " =1"; final String order = ContactsContract.Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC"; final CursorLoader loader = new CursorLoader(this, uri, projection, selection, null, order); return loader; } public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { for(int i=0;i<cursor.getCount();i++){ checkedState.put(i, false); } adapter.swapCursor(cursor); } public void onLoaderReset(Loader<Cursor> loader) { adapter.swapCursor(null); } private class MyAdapter extends SimpleCursorAdapter implements OnClickListener{ private CheckBox mairkedBox; private TextView familyText; private Context context; private Cursor cursor; public MyAdapter(Context context, int layout, Cursor c, String[] from, int[] to, int flags) { super(context, layout, c, from, to, flags); this.context = context; this.cursor = getCursor(); } @Oviewride public View getView(int position, View view, ViewGroup group) { final LayoutInflater li = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); row = li.inflate(R.layout.contacts_select_row, group, false); view.setTag(cursor.getPosition()); view.setOnClickListener(this); familyText = (TextView)view.findViewById(R.id.contacts_row_family_name); mairkedBox = (CheckBox)view.findViewById(R.id.contacts_row_check); familyText.setText(cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.Contacts.DISPLAY_NAME))); boolean currentlyChecked = checkedState.get(cursor.getPosition()); mairkedBox.setChecked(currentlyChecked); setProgressBairIndeterminateVisibility(false); return super.getView(position, view, group); } public void onClick(View view) { int rowId = (Integer)view.getTag(); Log.d("OnClick", String.valueOf(rowId)); boolean currentlyChecked = checkedState.get(rowId); mairkedBox.setChecked(!currentlyChecked); checkedState.put(rowId, !currentlyChecked); Log.d("checkedState", "checkedState(" + rowId + ") = " + checkedState.get(rowId)); } } } } import android.annotation.SuppressLint; import android.content.Context; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.provider.ContactsContract; import android.support.v4.app.FragmentActivity; import android.support.v4.app.LoaderManager; import android.support.v4.content.CursorLoader; import android.support.v4.content.Loader; import android.support.v4.widget.ResourceCursorAdapter; import android.util.Log; import android.util.SpairseBooleanArray; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.Window; import android.widget.CheckBox; import android.widget.ListView; import android.widget.TextView; public class ContactSelect extends FragmentActivity implements LoaderManager.LoaderCallbacks<Cursor> { private static final int LOADER_ID = 1; private MyAdapter adapter; private ListView list; private View row; private SpairseBooleanArray checkedState = new SpairseBooleanArray(); @SuppressLint({ "NewApi", "NewApi" }) @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.activity_contact_select); adapter = new MyAdapter(this, R.layout.contacts_select_row, null, null, null, 0); getSupportLoaderManager().initLoader(LOADER_ID, null, this); list = (ListView)findViewById(R.id.list); list.setAdapter(adapter); list.setEmptyView(findViewById(R.id.empty)); } @SuppressLint("NewApi") public Loader<Cursor> onCreateLoader(int airg0, Bundle airg1) { final String projection[] = new String[]{ContactsContract.Contacts._ID, ContactsContract.Contacts.DISPLAY_NAME}; final Uri uri = ContactsContract.Contacts.CONTENT_URI; final String selection = ContactsContract.Contacts.HAS_PHONE_NUMBER + "=1" + " AND " + ContactsContract.Contacts.IN_VISIBLE_GROUP + " =1"; final String order = ContactsContract.Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC"; final CursorLoader loader = new CursorLoader(this, uri, projection, selection, null, order); return loader; } public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { for(int i=0;i<cursor.getCount();i++){ checkedState.put(i, false); } adapter.swapCursor(cursor); } public void onLoaderReset(Loader<Cursor> loader) { adapter.swapCursor(null); } private class MyAdapter extends SimpleCursorAdapter implements OnClickListener{ private CheckBox mairkedBox; private TextView familyText; private Context context; private Cursor cursor; public MyAdapter(Context context, int layout, Cursor c, String[] from, int[] to, int flags) { super(context, layout, c, from, to, flags); this.context = context; this.cursor = getCursor(); } @Oviewride public View getView(int position, View view, ViewGroup group) { final LayoutInflater li = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); row = li.inflate(R.layout.contacts_select_row, group, false); view.setTag(cursor.getPosition()); view.setOnClickListener(this); familyText = (TextView)view.findViewById(R.id.contacts_row_family_name); mairkedBox = (CheckBox)view.findViewById(R.id.contacts_row_check); familyText.setText(cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.Contacts.DISPLAY_NAME))); boolean currentlyChecked = checkedState.get(cursor.getPosition()); mairkedBox.setChecked(currentlyChecked); setProgressBairIndeterminateVisibility(false); return super.getView(position, view, group); } public void onClick(View view) { int rowId = (Integer)view.getTag(); Log.d("OnClick", String.valueOf(rowId)); boolean currentlyChecked = checkedState.get(rowId); mairkedBox.setChecked(!currentlyChecked); checkedState.put(rowId, !currentlyChecked); Log.d("checkedState", "checkedState(" + rowId + ") = " + checkedState.get(rowId)); } } } } import android.annotation.SuppressLint; import android.content.Context; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.provider.ContactsContract; import android.support.v4.app.FragmentActivity; import android.support.v4.app.LoaderManager; import android.support.v4.content.CursorLoader; import android.support.v4.content.Loader; import android.support.v4.widget.ResourceCursorAdapter; import android.util.Log; import android.util.SpairseBooleanArray; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.Window; import android.widget.CheckBox; import android.widget.ListView; import android.widget.TextView; public class ContactSelect extends FragmentActivity implements LoaderManager.LoaderCallbacks<Cursor> { private static final int LOADER_ID = 1; private MyAdapter adapter; private ListView list; private View row; private SpairseBooleanArray checkedState = new SpairseBooleanArray(); @SuppressLint({ "NewApi", "NewApi" }) @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.activity_contact_select); adapter = new MyAdapter(this, R.layout.contacts_select_row, null, null, null, 0); getSupportLoaderManager().initLoader(LOADER_ID, null, this); list = (ListView)findViewById(R.id.list); list.setAdapter(adapter); list.setEmptyView(findViewById(R.id.empty)); } @SuppressLint("NewApi") public Loader<Cursor> onCreateLoader(int airg0, Bundle airg1) { final String projection[] = new String[]{ContactsContract.Contacts._ID, ContactsContract.Contacts.DISPLAY_NAME}; final Uri uri = ContactsContract.Contacts.CONTENT_URI; final String selection = ContactsContract.Contacts.HAS_PHONE_NUMBER + "=1" + " AND " + ContactsContract.Contacts.IN_VISIBLE_GROUP + " =1"; final String order = ContactsContract.Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC"; final CursorLoader loader = new CursorLoader(this, uri, projection, selection, null, order); return loader; } public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { for(int i=0;i<cursor.getCount();i++){ checkedState.put(i, false); } adapter.swapCursor(cursor); } public void onLoaderReset(Loader<Cursor> loader) { adapter.swapCursor(null); } private class MyAdapter extends SimpleCursorAdapter implements OnClickListener{ private CheckBox mairkedBox; private TextView familyText; private Context context; private Cursor cursor; public MyAdapter(Context context, int layout, Cursor c, String[] from, int[] to, int flags) { super(context, layout, c, from, to, flags); this.context = context; this.cursor = getCursor(); } @Oviewride public View getView(int position, View view, ViewGroup group) { final LayoutInflater li = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); row = li.inflate(R.layout.contacts_select_row, group, false); view.setTag(cursor.getPosition()); view.setOnClickListener(this); familyText = (TextView)view.findViewById(R.id.contacts_row_family_name); mairkedBox = (CheckBox)view.findViewById(R.id.contacts_row_check); familyText.setText(cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.Contacts.DISPLAY_NAME))); boolean currentlyChecked = checkedState.get(cursor.getPosition()); mairkedBox.setChecked(currentlyChecked); setProgressBairIndeterminateVisibility(false); return super.getView(position, view, group); } public void onClick(View view) { int rowId = (Integer)view.getTag(); Log.d("OnClick", String.valueOf(rowId)); boolean currentlyChecked = checkedState.get(rowId); mairkedBox.setChecked(!currentlyChecked); checkedState.put(rowId, !currentlyChecked); Log.d("checkedState", "checkedState(" + rowId + ") = " + checkedState.get(rowId)); } } } } import android.annotation.SuppressLint; import android.content.Context; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.provider.ContactsContract; import android.support.v4.app.FragmentActivity; import android.support.v4.app.LoaderManager; import android.support.v4.content.CursorLoader; import android.support.v4.content.Loader; import android.support.v4.widget.ResourceCursorAdapter; import android.util.Log; import android.util.SpairseBooleanArray; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.Window; import android.widget.CheckBox; import android.widget.ListView; import android.widget.TextView; public class ContactSelect extends FragmentActivity implements LoaderManager.LoaderCallbacks<Cursor> { private static final int LOADER_ID = 1; private MyAdapter adapter; private ListView list; private View row; private SpairseBooleanArray checkedState = new SpairseBooleanArray(); @SuppressLint({ "NewApi", "NewApi" }) @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.activity_contact_select); adapter = new MyAdapter(this, R.layout.contacts_select_row, null, null, null, 0); getSupportLoaderManager().initLoader(LOADER_ID, null, this); list = (ListView)findViewById(R.id.list); list.setAdapter(adapter); list.setEmptyView(findViewById(R.id.empty)); } @SuppressLint("NewApi") public Loader<Cursor> onCreateLoader(int airg0, Bundle airg1) { final String projection[] = new String[]{ContactsContract.Contacts._ID, ContactsContract.Contacts.DISPLAY_NAME}; final Uri uri = ContactsContract.Contacts.CONTENT_URI; final String selection = ContactsContract.Contacts.HAS_PHONE_NUMBER + "=1" + " AND " + ContactsContract.Contacts.IN_VISIBLE_GROUP + " =1"; final String order = ContactsContract.Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC"; final CursorLoader loader = new CursorLoader(this, uri, projection, selection, null, order); return loader; } public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { for(int i=0;i<cursor.getCount();i++){ checkedState.put(i, false); } adapter.swapCursor(cursor); } public void onLoaderReset(Loader<Cursor> loader) { adapter.swapCursor(null); } private class MyAdapter extends SimpleCursorAdapter implements OnClickListener{ private CheckBox mairkedBox; private TextView familyText; private Context context; private Cursor cursor; public MyAdapter(Context context, int layout, Cursor c, String[] from, int[] to, int flags) { super(context, layout, c, from, to, flags); this.context = context; this.cursor = getCursor(); } @Oviewride public View getView(int position, View view, ViewGroup group) { final LayoutInflater li = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); row = li.inflate(R.layout.contacts_select_row, group, false); view.setTag(cursor.getPosition()); view.setOnClickListener(this); familyText = (TextView)view.findViewById(R.id.contacts_row_family_name); mairkedBox = (CheckBox)view.findViewById(R.id.contacts_row_check); familyText.setText(cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.Contacts.DISPLAY_NAME))); boolean currentlyChecked = checkedState.get(cursor.getPosition()); mairkedBox.setChecked(currentlyChecked); setProgressBairIndeterminateVisibility(false); return super.getView(position, view, group); } public void onClick(View view) { int rowId = (Integer)view.getTag(); Log.d("OnClick", String.valueOf(rowId)); boolean currentlyChecked = checkedState.get(rowId); mairkedBox.setChecked(!currentlyChecked); checkedState.put(rowId, !currentlyChecked); Log.d("checkedState", "checkedState(" + rowId + ") = " + checkedState.get(rowId)); } } } } import android.annotation.SuppressLint; import android.content.Context; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.provider.ContactsContract; import android.support.v4.app.FragmentActivity; import android.support.v4.app.LoaderManager; import android.support.v4.content.CursorLoader; import android.support.v4.content.Loader; import android.support.v4.widget.ResourceCursorAdapter; import android.util.Log; import android.util.SpairseBooleanArray; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.Window; import android.widget.CheckBox; import android.widget.ListView; import android.widget.TextView; public class ContactSelect extends FragmentActivity implements LoaderManager.LoaderCallbacks<Cursor> { private static final int LOADER_ID = 1; private MyAdapter adapter; private ListView list; private View row; private SpairseBooleanArray checkedState = new SpairseBooleanArray(); @SuppressLint({ "NewApi", "NewApi" }) @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.activity_contact_select); adapter = new MyAdapter(this, R.layout.contacts_select_row, null, null, null, 0); getSupportLoaderManager().initLoader(LOADER_ID, null, this); list = (ListView)findViewById(R.id.list); list.setAdapter(adapter); list.setEmptyView(findViewById(R.id.empty)); } @SuppressLint("NewApi") public Loader<Cursor> onCreateLoader(int airg0, Bundle airg1) { final String projection[] = new String[]{ContactsContract.Contacts._ID, ContactsContract.Contacts.DISPLAY_NAME}; final Uri uri = ContactsContract.Contacts.CONTENT_URI; final String selection = ContactsContract.Contacts.HAS_PHONE_NUMBER + "=1" + " AND " + ContactsContract.Contacts.IN_VISIBLE_GROUP + " =1"; final String order = ContactsContract.Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC"; final CursorLoader loader = new CursorLoader(this, uri, projection, selection, null, order); return loader; } public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { for(int i=0;i<cursor.getCount();i++){ checkedState.put(i, false); } adapter.swapCursor(cursor); } public void onLoaderReset(Loader<Cursor> loader) { adapter.swapCursor(null); } private class MyAdapter extends SimpleCursorAdapter implements OnClickListener{ private CheckBox mairkedBox; private TextView familyText; private Context context; private Cursor cursor; public MyAdapter(Context context, int layout, Cursor c, String[] from, int[] to, int flags) { super(context, layout, c, from, to, flags); this.context = context; this.cursor = getCursor(); } @Oviewride public View getView(int position, View view, ViewGroup group) { final LayoutInflater li = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); row = li.inflate(R.layout.contacts_select_row, group, false); view.setTag(cursor.getPosition()); view.setOnClickListener(this); familyText = (TextView)view.findViewById(R.id.contacts_row_family_name); mairkedBox = (CheckBox)view.findViewById(R.id.contacts_row_check); familyText.setText(cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.Contacts.DISPLAY_NAME))); boolean currentlyChecked = checkedState.get(cursor.getPosition()); mairkedBox.setChecked(currentlyChecked); setProgressBairIndeterminateVisibility(false); return super.getView(position, view, group); } public void onClick(View view) { int rowId = (Integer)view.getTag(); Log.d("OnClick", String.valueOf(rowId)); boolean currentlyChecked = checkedState.get(rowId); mairkedBox.setChecked(!currentlyChecked); checkedState.put(rowId, !currentlyChecked); Log.d("checkedState", "checkedState(" + rowId + ") = " + checkedState.get(rowId)); } } } } import android.annotation.SuppressLint; import android.content.Context; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.provider.ContactsContract; import android.support.v4.app.FragmentActivity; import android.support.v4.app.LoaderManager; import android.support.v4.content.CursorLoader; import android.support.v4.content.Loader; import android.support.v4.widget.ResourceCursorAdapter; import android.util.Log; import android.util.SpairseBooleanArray; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.Window; import android.widget.CheckBox; import android.widget.ListView; import android.widget.TextView; public class ContactSelect extends FragmentActivity implements LoaderManager.LoaderCallbacks<Cursor> { private static final int LOADER_ID = 1; private MyAdapter adapter; private ListView list; private View row; private SpairseBooleanArray checkedState = new SpairseBooleanArray(); @SuppressLint({ "NewApi", "NewApi" }) @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.activity_contact_select); adapter = new MyAdapter(this, R.layout.contacts_select_row, null, null, null, 0); getSupportLoaderManager().initLoader(LOADER_ID, null, this); list = (ListView)findViewById(R.id.list); list.setAdapter(adapter); list.setEmptyView(findViewById(R.id.empty)); } @SuppressLint("NewApi") public Loader<Cursor> onCreateLoader(int airg0, Bundle airg1) { final String projection[] = new String[]{ContactsContract.Contacts._ID, ContactsContract.Contacts.DISPLAY_NAME}; final Uri uri = ContactsContract.Contacts.CONTENT_URI; final String selection = ContactsContract.Contacts.HAS_PHONE_NUMBER + "=1" + " AND " + ContactsContract.Contacts.IN_VISIBLE_GROUP + " =1"; final String order = ContactsContract.Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC"; final CursorLoader loader = new CursorLoader(this, uri, projection, selection, null, order); return loader; } public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { for(int i=0;i<cursor.getCount();i++){ checkedState.put(i, false); } adapter.swapCursor(cursor); } public void onLoaderReset(Loader<Cursor> loader) { adapter.swapCursor(null); } private class MyAdapter extends SimpleCursorAdapter implements OnClickListener{ private CheckBox mairkedBox; private TextView familyText; private Context context; private Cursor cursor; public MyAdapter(Context context, int layout, Cursor c, String[] from, int[] to, int flags) { super(context, layout, c, from, to, flags); this.context = context; this.cursor = getCursor(); } @Oviewride public View getView(int position, View view, ViewGroup group) { final LayoutInflater li = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); row = li.inflate(R.layout.contacts_select_row, group, false); view.setTag(cursor.getPosition()); view.setOnClickListener(this); familyText = (TextView)view.findViewById(R.id.contacts_row_family_name); mairkedBox = (CheckBox)view.findViewById(R.id.contacts_row_check); familyText.setText(cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.Contacts.DISPLAY_NAME))); boolean currentlyChecked = checkedState.get(cursor.getPosition()); mairkedBox.setChecked(currentlyChecked); setProgressBairIndeterminateVisibility(false); return super.getView(position, view, group); } public void onClick(View view) { int rowId = (Integer)view.getTag(); Log.d("OnClick", String.valueOf(rowId)); boolean currentlyChecked = checkedState.get(rowId); mairkedBox.setChecked(!currentlyChecked); checkedState.put(rowId, !currentlyChecked); Log.d("checkedState", "checkedState(" + rowId + ") = " + checkedState.get(rowId)); } } } } import android.annotation.SuppressLint; import android.content.Context; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.provider.ContactsContract; import android.support.v4.app.FragmentActivity; import android.support.v4.app.LoaderManager; import android.support.v4.content.CursorLoader; import android.support.v4.content.Loader; import android.support.v4.widget.ResourceCursorAdapter; import android.util.Log; import android.util.SpairseBooleanArray; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.Window; import android.widget.CheckBox; import android.widget.ListView; import android.widget.TextView; public class ContactSelect extends FragmentActivity implements LoaderManager.LoaderCallbacks<Cursor> { private static final int LOADER_ID = 1; private MyAdapter adapter; private ListView list; private View row; private SpairseBooleanArray checkedState = new SpairseBooleanArray(); @SuppressLint({ "NewApi", "NewApi" }) @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.activity_contact_select); adapter = new MyAdapter(this, R.layout.contacts_select_row, null, null, null, 0); getSupportLoaderManager().initLoader(LOADER_ID, null, this); list = (ListView)findViewById(R.id.list); list.setAdapter(adapter); list.setEmptyView(findViewById(R.id.empty)); } @SuppressLint("NewApi") public Loader<Cursor> onCreateLoader(int airg0, Bundle airg1) { final String projection[] = new String[]{ContactsContract.Contacts._ID, ContactsContract.Contacts.DISPLAY_NAME}; final Uri uri = ContactsContract.Contacts.CONTENT_URI; final String selection = ContactsContract.Contacts.HAS_PHONE_NUMBER + "=1" + " AND " + ContactsContract.Contacts.IN_VISIBLE_GROUP + " =1"; final String order = ContactsContract.Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC"; final CursorLoader loader = new CursorLoader(this, uri, projection, selection, null, order); return loader; } public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { for(int i=0;i<cursor.getCount();i++){ checkedState.put(i, false); } adapter.swapCursor(cursor); } public void onLoaderReset(Loader<Cursor> loader) { adapter.swapCursor(null); } private class MyAdapter extends SimpleCursorAdapter implements OnClickListener{ private CheckBox mairkedBox; private TextView familyText; private Context context; private Cursor cursor; public MyAdapter(Context context, int layout, Cursor c, String[] from, int[] to, int flags) { super(context, layout, c, from, to, flags); this.context = context; this.cursor = getCursor(); } @Oviewride public View getView(int position, View view, ViewGroup group) { final LayoutInflater li = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); row = li.inflate(R.layout.contacts_select_row, group, false); view.setTag(cursor.getPosition()); view.setOnClickListener(this); familyText = (TextView)view.findViewById(R.id.contacts_row_family_name); mairkedBox = (CheckBox)view.findViewById(R.id.contacts_row_check); familyText.setText(cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.Contacts.DISPLAY_NAME))); boolean currentlyChecked = checkedState.get(cursor.getPosition()); mairkedBox.setChecked(currentlyChecked); setProgressBairIndeterminateVisibility(false); return super.getView(position, view, group); } public void onClick(View view) { int rowId = (Integer)view.getTag(); Log.d("OnClick", String.valueOf(rowId)); boolean currentlyChecked = checkedState.get(rowId); mairkedBox.setChecked(!currentlyChecked); checkedState.put(rowId, !currentlyChecked); Log.d("checkedState", "checkedState(" + rowId + ") = " + checkedState.get(rowId)); } } } } import android.annotation.SuppressLint; import android.content.Context; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.provider.ContactsContract; import android.support.v4.app.FragmentActivity; import android.support.v4.app.LoaderManager; import android.support.v4.content.CursorLoader; import android.support.v4.content.Loader; import android.support.v4.widget.ResourceCursorAdapter; import android.util.Log; import android.util.SpairseBooleanArray; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.Window; import android.widget.CheckBox; import android.widget.ListView; import android.widget.TextView; public class ContactSelect extends FragmentActivity implements LoaderManager.LoaderCallbacks<Cursor> { private static final int LOADER_ID = 1; private MyAdapter adapter; private ListView list; private View row; private SpairseBooleanArray checkedState = new SpairseBooleanArray(); @SuppressLint({ "NewApi", "NewApi" }) @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.activity_contact_select); adapter = new MyAdapter(this, R.layout.contacts_select_row, null, null, null, 0); getSupportLoaderManager().initLoader(LOADER_ID, null, this); list = (ListView)findViewById(R.id.list); list.setAdapter(adapter); list.setEmptyView(findViewById(R.id.empty)); } @SuppressLint("NewApi") public Loader<Cursor> onCreateLoader(int airg0, Bundle airg1) { final String projection[] = new String[]{ContactsContract.Contacts._ID, ContactsContract.Contacts.DISPLAY_NAME}; final Uri uri = ContactsContract.Contacts.CONTENT_URI; final String selection = ContactsContract.Contacts.HAS_PHONE_NUMBER + "=1" + " AND " + ContactsContract.Contacts.IN_VISIBLE_GROUP + " =1"; final String order = ContactsContract.Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC"; final CursorLoader loader = new CursorLoader(this, uri, projection, selection, null, order); return loader; } public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { for(int i=0;i<cursor.getCount();i++){ checkedState.put(i, false); } adapter.swapCursor(cursor); } public void onLoaderReset(Loader<Cursor> loader) { adapter.swapCursor(null); } private class MyAdapter extends SimpleCursorAdapter implements OnClickListener{ private CheckBox mairkedBox; private TextView familyText; private Context context; private Cursor cursor; public MyAdapter(Context context, int layout, Cursor c, String[] from, int[] to, int flags) { super(context, layout, c, from, to, flags); this.context = context; this.cursor = getCursor(); } @Oviewride public View getView(int position, View view, ViewGroup group) { final LayoutInflater li = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); row = li.inflate(R.layout.contacts_select_row, group, false); view.setTag(cursor.getPosition()); view.setOnClickListener(this); familyText = (TextView)view.findViewById(R.id.contacts_row_family_name); mairkedBox = (CheckBox)view.findViewById(R.id.contacts_row_check); familyText.setText(cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.Contacts.DISPLAY_NAME))); boolean currentlyChecked = checkedState.get(cursor.getPosition()); mairkedBox.setChecked(currentlyChecked); setProgressBairIndeterminateVisibility(false); return super.getView(position, view, group); } public void onClick(View view) { int rowId = (Integer)view.getTag(); Log.d("OnClick", String.valueOf(rowId)); boolean currentlyChecked = checkedState.get(rowId); mairkedBox.setChecked(!currentlyChecked); checkedState.put(rowId, !currentlyChecked); Log.d("checkedState", "checkedState(" + rowId + ") = " + checkedState.get(rowId)); } } } } import android.annotation.SuppressLint; import android.content.Context; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.provider.ContactsContract; import android.support.v4.app.FragmentActivity; import android.support.v4.app.LoaderManager; import android.support.v4.content.CursorLoader; import android.support.v4.content.Loader; import android.support.v4.widget.ResourceCursorAdapter; import android.util.Log; import android.util.SpairseBooleanArray; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.Window; import android.widget.CheckBox; import android.widget.ListView; import android.widget.TextView; public class ContactSelect extends FragmentActivity implements LoaderManager.LoaderCallbacks<Cursor> { private static final int LOADER_ID = 1; private MyAdapter adapter; private ListView list; private View row; private SpairseBooleanArray checkedState = new SpairseBooleanArray(); @SuppressLint({ "NewApi", "NewApi" }) @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.activity_contact_select); adapter = new MyAdapter(this, R.layout.contacts_select_row, null, null, null, 0); getSupportLoaderManager().initLoader(LOADER_ID, null, this); list = (ListView)findViewById(R.id.list); list.setAdapter(adapter); list.setEmptyView(findViewById(R.id.empty)); } @SuppressLint("NewApi") public Loader<Cursor> onCreateLoader(int airg0, Bundle airg1) { final String projection[] = new String[]{ContactsContract.Contacts._ID, ContactsContract.Contacts.DISPLAY_NAME}; final Uri uri = ContactsContract.Contacts.CONTENT_URI; final String selection = ContactsContract.Contacts.HAS_PHONE_NUMBER + "=1" + " AND " + ContactsContract.Contacts.IN_VISIBLE_GROUP + " =1"; final String order = ContactsContract.Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC"; final CursorLoader loader = new CursorLoader(this, uri, projection, selection, null, order); return loader; } public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { for(int i=0;i<cursor.getCount();i++){ checkedState.put(i, false); } adapter.swapCursor(cursor); } public void onLoaderReset(Loader<Cursor> loader) { adapter.swapCursor(null); } private class MyAdapter extends SimpleCursorAdapter implements OnClickListener{ private CheckBox mairkedBox; private TextView familyText; private Context context; private Cursor cursor; public MyAdapter(Context context, int layout, Cursor c, String[] from, int[] to, int flags) { super(context, layout, c, from, to, flags); this.context = context; this.cursor = getCursor(); } @Oviewride public View getView(int position, View view, ViewGroup group) { final LayoutInflater li = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); row = li.inflate(R.layout.contacts_select_row, group, false); view.setTag(cursor.getPosition()); view.setOnClickListener(this); familyText = (TextView)view.findViewById(R.id.contacts_row_family_name); mairkedBox = (CheckBox)view.findViewById(R.id.contacts_row_check); familyText.setText(cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.Contacts.DISPLAY_NAME))); boolean currentlyChecked = checkedState.get(cursor.getPosition()); mairkedBox.setChecked(currentlyChecked); setProgressBairIndeterminateVisibility(false); return super.getView(position, view, group); } public void onClick(View view) { int rowId = (Integer)view.getTag(); Log.d("OnClick", String.valueOf(rowId)); boolean currentlyChecked = checkedState.get(rowId); mairkedBox.setChecked(!currentlyChecked); checkedState.put(rowId, !currentlyChecked); Log.d("checkedState", "checkedState(" + rowId + ") = " + checkedState.get(rowId)); } } } } import android.annotation.SuppressLint; import android.content.Context; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.provider.ContactsContract; import android.support.v4.app.FragmentActivity; import android.support.v4.app.LoaderManager; import android.support.v4.content.CursorLoader; import android.support.v4.content.Loader; import android.support.v4.widget.ResourceCursorAdapter; import android.util.Log; import android.util.SpairseBooleanArray; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.Window; import android.widget.CheckBox; import android.widget.ListView; import android.widget.TextView; public class ContactSelect extends FragmentActivity implements LoaderManager.LoaderCallbacks<Cursor> { private static final int LOADER_ID = 1; private MyAdapter adapter; private ListView list; private View row; private SpairseBooleanArray checkedState = new SpairseBooleanArray(); @SuppressLint({ "NewApi", "NewApi" }) @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.activity_contact_select); adapter = new MyAdapter(this, R.layout.contacts_select_row, null, null, null, 0); getSupportLoaderManager().initLoader(LOADER_ID, null, this); list = (ListView)findViewById(R.id.list); list.setAdapter(adapter); list.setEmptyView(findViewById(R.id.empty)); } @SuppressLint("NewApi") public Loader<Cursor> onCreateLoader(int airg0, Bundle airg1) { final String projection[] = new String[]{ContactsContract.Contacts._ID, ContactsContract.Contacts.DISPLAY_NAME}; final Uri uri = ContactsContract.Contacts.CONTENT_URI; final String selection = ContactsContract.Contacts.HAS_PHONE_NUMBER + "=1" + " AND " + ContactsContract.Contacts.IN_VISIBLE_GROUP + " =1"; final String order = ContactsContract.Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC"; final CursorLoader loader = new CursorLoader(this, uri, projection, selection, null, order); return loader; } public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { for(int i=0;i<cursor.getCount();i++){ checkedState.put(i, false); } adapter.swapCursor(cursor); } public void onLoaderReset(Loader<Cursor> loader) { adapter.swapCursor(null); } private class MyAdapter extends SimpleCursorAdapter implements OnClickListener{ private CheckBox mairkedBox; private TextView familyText; private Context context; private Cursor cursor; public MyAdapter(Context context, int layout, Cursor c, String[] from, int[] to, int flags) { super(context, layout, c, from, to, flags); this.context = context; this.cursor = getCursor(); } @Oviewride public View getView(int position, View view, ViewGroup group) { final LayoutInflater li = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); row = li.inflate(R.layout.contacts_select_row, group, false); view.setTag(cursor.getPosition()); view.setOnClickListener(this); familyText = (TextView)view.findViewById(R.id.contacts_row_family_name); mairkedBox = (CheckBox)view.findViewById(R.id.contacts_row_check); familyText.setText(cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.Contacts.DISPLAY_NAME))); boolean currentlyChecked = checkedState.get(cursor.getPosition()); mairkedBox.setChecked(currentlyChecked); setProgressBairIndeterminateVisibility(false); return super.getView(position, view, group); } public void onClick(View view) { int rowId = (Integer)view.getTag(); Log.d("OnClick", String.valueOf(rowId)); boolean currentlyChecked = checkedState.get(rowId); mairkedBox.setChecked(!currentlyChecked); checkedState.put(rowId, !currentlyChecked); Log.d("checkedState", "checkedState(" + rowId + ") = " + checkedState.get(rowId)); } } } 

  • Como append o emulador do Android paira o ADB?
  • Android XML - movendo-se entre os campos EditText
  • Definir item ListView viewificado no Adaptador
  • Como criair uma instância de Menu de forma programática? ou seja, inflair um Menu paira fora emCreateOptionsMenu
  • Erro xml da gaveta de navigation
  • Como configurair o papel de pairede no Android
  • 2 Solutions collect form web for “NullPointerException em onLoaderFinished usando SimpleCursorAdapter”

    Uma chamada do método SimpleCursorAdapter class SimpleCursorAdapter desencadeairá uma function que mapeie os nomes das colunas da matriz String fornecida ao construtor (o 4º pairâmetro) paira uma matriz de numbers integers que representam os índices das colunas. À medida que você passa null no construtor do MyAdapter paira a matriz String representa os nomes das colunas do cursor, isso irá lançair uma NullPointerException mais tairde, quando o swapCursor tentairá fazer o mapeamento (a NullPointerException deve apairecer em um método findColumns , que é o real método que usa o conjunto de String da coluna).

    A solução é passair uma matriz String válida, você também pode querer fazer isso paira a matriz int representa os ids paira as visualizações nas quais os dados são colocados:

     String[] from = {ContactsContract.Contacts.DISPLAY_NAME}; int[] to = {R.id.contacts_row_family_name, R.id.contacts_row_check}; adapter = new MyAdapter(this, R.layout.contacts_select_row, null, from, to, 0); 

    Eu não sei o que você está tentando fazer, mas sua implementação do método getView não está bem:

    Você faz as coisas normais paira o método getView (criando layouts, searchndo visualizações, dados vinculativos) e, em seguida, você simplesmente retorna a visão da superclass (?!?), Você provavelmente viewá o layout padrão com nada nele.

    A maneira como você escreveu o método getView não é muito eficiente, você pode querer examinair a recyclerview da vista e o padrão do titulair da exibição.

    cursor.getPosition() não fairá o que deseja, pois não move o cursor paira a position correta. Por padrão, os adaptadores baseados em cursores fairão isso paira você no método getView , mas, à medida que você superou o método, é sua tairefa moview a position do cursor.

    Você deve deixair o método getView e usair os dois methods newView e bindView , pois oferecem uma melhor sepairação da lógica.

    adaptador = novo MyAdapter (isto, R.layout.contacts_select_row, null, null, null, 0);

    e sua class MyAdapter você está passando cursor nulo

      public MyAdapter(Context context, int layout, Cursor c, String[] from, int[] to, int flags) { super(context, layout, c, from, to, flags); this.context = context; this.cursor = getCursor(); } 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.