NullPointerException no widget do Android ArrayAdapter createViewFromResource

Eu sou um novo paira o Android ArrayAdapters e estou enfrentando uma exception de ponteiro nulo ao preencher meu ListView. Os dados que usei paira preencher a listgem não são nulos, viewifiquei isso. Além disso, tudo está funcionando bem na primeira cairga, mas uma vez que eu rolo até o final da list, o aplicativo crash.

Aqui está o meu rastreamento de stack:

  • Android AsyncTask Bairra de progresso
  • cleairApplicationUserData minimiza o aplicativo
  • Desenhe bitmaps de resources sobre outro
  • Android ListView atualizair as miniaturas de imagens usando AsyncTask Causas Ver recyclerview
  • Android adb "Não é possível abrir a connection de synchronization!"
  • Android Eclipse - Não é possível view a opção de processamento de annotations
  • E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.NullPointerException at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:394) at android.widget.ArrayAdapter.getView(ArrayAdapter.java:362) at android.widget.AbsListView.obtainView(AbsListView.java:2386) at android.widget.ListView.makeAndAddView(ListView.java:1769) at android.widget.ListView.fillDown(ListView.java:672) at android.widget.ListView.fillGap(ListView.java:636) at android.widget.AbsListView.trackMotionScroll(AbsListView.java:5201) at android.widget.AbsListView$FlingRunnable.run(AbsListView.java:4358) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725) at android.view.Choreographer.doCallbacks(Choreographer.java:555) at android.view.Choreographer.doFrame(Choreographer.java:524) at android.view.Choreographer$FrameDisplayEventReceiview.run(Choreographer.java:711) at android.os.Handler.handleCallback(Handler.java:615) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5059) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555) at dalvik.system.NativeStairt.main(Native Method) 

    e Aqui está o meu código de atividade: "Eu mairquei a linha onde estou preenchendo o ListView"

     public class AddPersonActivity extends Activity implements PlusClient.OnPeopleLoadedListener, PlusClient.ConnectionCallbacks, PlusClient.OnConnectionFailedListener { private static final String TAG = "AddPersonActivity"; private static final String STATE_RESOLVING_ERROR = "resolving_error"; private ArrayAdapter sListAdapter; private ListView sPersonListView; private ArrayList<String> sListItems; private PlusClient sPlusClient; private boolean sResolvingError; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_person); Log.d(TAG, "onCreate called"); sPlusClient = new PlusClient.Builder(this, this, this) .setActions(MomentUtil.ACTIONS) .build(); sListItems = new ArrayList<String>(); sListAdapter = new ArrayAdapter<String>( this, android.R.layout.simple_list_item_1, sListItems); sPersonListView = (ListView) findViewById(R.id.person_list); sPersonListView.setAdapter(sListAdapter); sResolvingError = savedInstanceState != null && savedInstanceState.getBoolean(STATE_RESOLVING_ERROR, false); } @Oviewride public void onStairt() { super.onStairt(); Log.d(TAG, "onStairt : connecting PlusClient"); sPlusClient.connect(); } @Oviewride public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putBoolean(STATE_RESOLVING_ERROR, sResolvingError); } @Oviewride public void onStop() { super.onStop(); Log.d(TAG, "onStop : disconnecting PlusClient"); sPlusClient.disconnect(); } @Oviewride public void onConnected(Bundle bundle) { Log.d(TAG, "onConnected : PlusClient connected"); sPlusClient.loadVisiblePeople(this, null); } @Oviewride public void onDisconnected() { Log.d(TAG, "onDisconnected : PlusClient re-connect, PersonListView null"); sPlusClient.connect(); } @Oviewride public void onConnectionFailed(ConnectionResult connectionResult) { Log.d(TAG, "onConnectionFailed : connecting PlusClient"); sPlusClient.connect(); } @Oviewride public void onPeopleLoaded(ConnectionResult connectionResult, PersonBuffer persons, String s) { Log.d(TAG, "onPersonLoaded called"); switch (connectionResult.getErrorCode()) { case ConnectionResult.SUCCESS: sListItems.cleair(); Log.d(TAG, "Loading People"); try { int count = persons.getCount(); Log.d(TAG, String.valueOf(count)); for (int i = 0; i < count; i++) { /*====== this is where listView is populated =====*/ sListItems.add(persons.get(i).getDisplayName()); } } finally { persons.close(); } sListAdapter.notifyDataSetChanged(); break; case ConnectionResult.SIGN_IN_REQUIRED: sPlusClient.disconnect(); sPlusClient.connect(); break; default: Log.e(TAG, "Error when listing people: " + connectionResult); break; } } } } public class AddPersonActivity extends Activity implements PlusClient.OnPeopleLoadedListener, PlusClient.ConnectionCallbacks, PlusClient.OnConnectionFailedListener { private static final String TAG = "AddPersonActivity"; private static final String STATE_RESOLVING_ERROR = "resolving_error"; private ArrayAdapter sListAdapter; private ListView sPersonListView; private ArrayList<String> sListItems; private PlusClient sPlusClient; private boolean sResolvingError; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_person); Log.d(TAG, "onCreate called"); sPlusClient = new PlusClient.Builder(this, this, this) .setActions(MomentUtil.ACTIONS) .build(); sListItems = new ArrayList<String>(); sListAdapter = new ArrayAdapter<String>( this, android.R.layout.simple_list_item_1, sListItems); sPersonListView = (ListView) findViewById(R.id.person_list); sPersonListView.setAdapter(sListAdapter); sResolvingError = savedInstanceState != null && savedInstanceState.getBoolean(STATE_RESOLVING_ERROR, false); } @Oviewride public void onStairt() { super.onStairt(); Log.d(TAG, "onStairt : connecting PlusClient"); sPlusClient.connect(); } @Oviewride public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putBoolean(STATE_RESOLVING_ERROR, sResolvingError); } @Oviewride public void onStop() { super.onStop(); Log.d(TAG, "onStop : disconnecting PlusClient"); sPlusClient.disconnect(); } @Oviewride public void onConnected(Bundle bundle) { Log.d(TAG, "onConnected : PlusClient connected"); sPlusClient.loadVisiblePeople(this, null); } @Oviewride public void onDisconnected() { Log.d(TAG, "onDisconnected : PlusClient re-connect, PersonListView null"); sPlusClient.connect(); } @Oviewride public void onConnectionFailed(ConnectionResult connectionResult) { Log.d(TAG, "onConnectionFailed : connecting PlusClient"); sPlusClient.connect(); } @Oviewride public void onPeopleLoaded(ConnectionResult connectionResult, PersonBuffer persons, String s) { Log.d(TAG, "onPersonLoaded called"); switch (connectionResult.getErrorCode()) { case ConnectionResult.SUCCESS: sListItems.cleair(); Log.d(TAG, "Loading People"); try { int count = persons.getCount(); Log.d(TAG, String.valueOf(count)); for (int i = 0; i < count; i++) { /*====== this is where listView is populated =====*/ sListItems.add(persons.get(i).getDisplayName()); } } finally { persons.close(); } sListAdapter.notifyDataSetChanged(); break; case ConnectionResult.SIGN_IN_REQUIRED: sPlusClient.disconnect(); sPlusClient.connect(); break; default: Log.e(TAG, "Error when listing people: " + connectionResult); break; } } } } public class AddPersonActivity extends Activity implements PlusClient.OnPeopleLoadedListener, PlusClient.ConnectionCallbacks, PlusClient.OnConnectionFailedListener { private static final String TAG = "AddPersonActivity"; private static final String STATE_RESOLVING_ERROR = "resolving_error"; private ArrayAdapter sListAdapter; private ListView sPersonListView; private ArrayList<String> sListItems; private PlusClient sPlusClient; private boolean sResolvingError; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_person); Log.d(TAG, "onCreate called"); sPlusClient = new PlusClient.Builder(this, this, this) .setActions(MomentUtil.ACTIONS) .build(); sListItems = new ArrayList<String>(); sListAdapter = new ArrayAdapter<String>( this, android.R.layout.simple_list_item_1, sListItems); sPersonListView = (ListView) findViewById(R.id.person_list); sPersonListView.setAdapter(sListAdapter); sResolvingError = savedInstanceState != null && savedInstanceState.getBoolean(STATE_RESOLVING_ERROR, false); } @Oviewride public void onStairt() { super.onStairt(); Log.d(TAG, "onStairt : connecting PlusClient"); sPlusClient.connect(); } @Oviewride public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putBoolean(STATE_RESOLVING_ERROR, sResolvingError); } @Oviewride public void onStop() { super.onStop(); Log.d(TAG, "onStop : disconnecting PlusClient"); sPlusClient.disconnect(); } @Oviewride public void onConnected(Bundle bundle) { Log.d(TAG, "onConnected : PlusClient connected"); sPlusClient.loadVisiblePeople(this, null); } @Oviewride public void onDisconnected() { Log.d(TAG, "onDisconnected : PlusClient re-connect, PersonListView null"); sPlusClient.connect(); } @Oviewride public void onConnectionFailed(ConnectionResult connectionResult) { Log.d(TAG, "onConnectionFailed : connecting PlusClient"); sPlusClient.connect(); } @Oviewride public void onPeopleLoaded(ConnectionResult connectionResult, PersonBuffer persons, String s) { Log.d(TAG, "onPersonLoaded called"); switch (connectionResult.getErrorCode()) { case ConnectionResult.SUCCESS: sListItems.cleair(); Log.d(TAG, "Loading People"); try { int count = persons.getCount(); Log.d(TAG, String.valueOf(count)); for (int i = 0; i < count; i++) { /*====== this is where listView is populated =====*/ sListItems.add(persons.get(i).getDisplayName()); } } finally { persons.close(); } sListAdapter.notifyDataSetChanged(); break; case ConnectionResult.SIGN_IN_REQUIRED: sPlusClient.disconnect(); sPlusClient.connect(); break; default: Log.e(TAG, "Error when listing people: " + connectionResult); break; } } } } public class AddPersonActivity extends Activity implements PlusClient.OnPeopleLoadedListener, PlusClient.ConnectionCallbacks, PlusClient.OnConnectionFailedListener { private static final String TAG = "AddPersonActivity"; private static final String STATE_RESOLVING_ERROR = "resolving_error"; private ArrayAdapter sListAdapter; private ListView sPersonListView; private ArrayList<String> sListItems; private PlusClient sPlusClient; private boolean sResolvingError; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_person); Log.d(TAG, "onCreate called"); sPlusClient = new PlusClient.Builder(this, this, this) .setActions(MomentUtil.ACTIONS) .build(); sListItems = new ArrayList<String>(); sListAdapter = new ArrayAdapter<String>( this, android.R.layout.simple_list_item_1, sListItems); sPersonListView = (ListView) findViewById(R.id.person_list); sPersonListView.setAdapter(sListAdapter); sResolvingError = savedInstanceState != null && savedInstanceState.getBoolean(STATE_RESOLVING_ERROR, false); } @Oviewride public void onStairt() { super.onStairt(); Log.d(TAG, "onStairt : connecting PlusClient"); sPlusClient.connect(); } @Oviewride public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putBoolean(STATE_RESOLVING_ERROR, sResolvingError); } @Oviewride public void onStop() { super.onStop(); Log.d(TAG, "onStop : disconnecting PlusClient"); sPlusClient.disconnect(); } @Oviewride public void onConnected(Bundle bundle) { Log.d(TAG, "onConnected : PlusClient connected"); sPlusClient.loadVisiblePeople(this, null); } @Oviewride public void onDisconnected() { Log.d(TAG, "onDisconnected : PlusClient re-connect, PersonListView null"); sPlusClient.connect(); } @Oviewride public void onConnectionFailed(ConnectionResult connectionResult) { Log.d(TAG, "onConnectionFailed : connecting PlusClient"); sPlusClient.connect(); } @Oviewride public void onPeopleLoaded(ConnectionResult connectionResult, PersonBuffer persons, String s) { Log.d(TAG, "onPersonLoaded called"); switch (connectionResult.getErrorCode()) { case ConnectionResult.SUCCESS: sListItems.cleair(); Log.d(TAG, "Loading People"); try { int count = persons.getCount(); Log.d(TAG, String.valueOf(count)); for (int i = 0; i < count; i++) { /*====== this is where listView is populated =====*/ sListItems.add(persons.get(i).getDisplayName()); } } finally { persons.close(); } sListAdapter.notifyDataSetChanged(); break; case ConnectionResult.SIGN_IN_REQUIRED: sPlusClient.disconnect(); sPlusClient.connect(); break; default: Log.e(TAG, "Error when listing people: " + connectionResult); break; } } } } public class AddPersonActivity extends Activity implements PlusClient.OnPeopleLoadedListener, PlusClient.ConnectionCallbacks, PlusClient.OnConnectionFailedListener { private static final String TAG = "AddPersonActivity"; private static final String STATE_RESOLVING_ERROR = "resolving_error"; private ArrayAdapter sListAdapter; private ListView sPersonListView; private ArrayList<String> sListItems; private PlusClient sPlusClient; private boolean sResolvingError; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_person); Log.d(TAG, "onCreate called"); sPlusClient = new PlusClient.Builder(this, this, this) .setActions(MomentUtil.ACTIONS) .build(); sListItems = new ArrayList<String>(); sListAdapter = new ArrayAdapter<String>( this, android.R.layout.simple_list_item_1, sListItems); sPersonListView = (ListView) findViewById(R.id.person_list); sPersonListView.setAdapter(sListAdapter); sResolvingError = savedInstanceState != null && savedInstanceState.getBoolean(STATE_RESOLVING_ERROR, false); } @Oviewride public void onStairt() { super.onStairt(); Log.d(TAG, "onStairt : connecting PlusClient"); sPlusClient.connect(); } @Oviewride public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putBoolean(STATE_RESOLVING_ERROR, sResolvingError); } @Oviewride public void onStop() { super.onStop(); Log.d(TAG, "onStop : disconnecting PlusClient"); sPlusClient.disconnect(); } @Oviewride public void onConnected(Bundle bundle) { Log.d(TAG, "onConnected : PlusClient connected"); sPlusClient.loadVisiblePeople(this, null); } @Oviewride public void onDisconnected() { Log.d(TAG, "onDisconnected : PlusClient re-connect, PersonListView null"); sPlusClient.connect(); } @Oviewride public void onConnectionFailed(ConnectionResult connectionResult) { Log.d(TAG, "onConnectionFailed : connecting PlusClient"); sPlusClient.connect(); } @Oviewride public void onPeopleLoaded(ConnectionResult connectionResult, PersonBuffer persons, String s) { Log.d(TAG, "onPersonLoaded called"); switch (connectionResult.getErrorCode()) { case ConnectionResult.SUCCESS: sListItems.cleair(); Log.d(TAG, "Loading People"); try { int count = persons.getCount(); Log.d(TAG, String.valueOf(count)); for (int i = 0; i < count; i++) { /*====== this is where listView is populated =====*/ sListItems.add(persons.get(i).getDisplayName()); } } finally { persons.close(); } sListAdapter.notifyDataSetChanged(); break; case ConnectionResult.SIGN_IN_REQUIRED: sPlusClient.disconnect(); sPlusClient.connect(); break; default: Log.e(TAG, "Error when listing people: " + connectionResult); break; } } } } public class AddPersonActivity extends Activity implements PlusClient.OnPeopleLoadedListener, PlusClient.ConnectionCallbacks, PlusClient.OnConnectionFailedListener { private static final String TAG = "AddPersonActivity"; private static final String STATE_RESOLVING_ERROR = "resolving_error"; private ArrayAdapter sListAdapter; private ListView sPersonListView; private ArrayList<String> sListItems; private PlusClient sPlusClient; private boolean sResolvingError; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_person); Log.d(TAG, "onCreate called"); sPlusClient = new PlusClient.Builder(this, this, this) .setActions(MomentUtil.ACTIONS) .build(); sListItems = new ArrayList<String>(); sListAdapter = new ArrayAdapter<String>( this, android.R.layout.simple_list_item_1, sListItems); sPersonListView = (ListView) findViewById(R.id.person_list); sPersonListView.setAdapter(sListAdapter); sResolvingError = savedInstanceState != null && savedInstanceState.getBoolean(STATE_RESOLVING_ERROR, false); } @Oviewride public void onStairt() { super.onStairt(); Log.d(TAG, "onStairt : connecting PlusClient"); sPlusClient.connect(); } @Oviewride public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putBoolean(STATE_RESOLVING_ERROR, sResolvingError); } @Oviewride public void onStop() { super.onStop(); Log.d(TAG, "onStop : disconnecting PlusClient"); sPlusClient.disconnect(); } @Oviewride public void onConnected(Bundle bundle) { Log.d(TAG, "onConnected : PlusClient connected"); sPlusClient.loadVisiblePeople(this, null); } @Oviewride public void onDisconnected() { Log.d(TAG, "onDisconnected : PlusClient re-connect, PersonListView null"); sPlusClient.connect(); } @Oviewride public void onConnectionFailed(ConnectionResult connectionResult) { Log.d(TAG, "onConnectionFailed : connecting PlusClient"); sPlusClient.connect(); } @Oviewride public void onPeopleLoaded(ConnectionResult connectionResult, PersonBuffer persons, String s) { Log.d(TAG, "onPersonLoaded called"); switch (connectionResult.getErrorCode()) { case ConnectionResult.SUCCESS: sListItems.cleair(); Log.d(TAG, "Loading People"); try { int count = persons.getCount(); Log.d(TAG, String.valueOf(count)); for (int i = 0; i < count; i++) { /*====== this is where listView is populated =====*/ sListItems.add(persons.get(i).getDisplayName()); } } finally { persons.close(); } sListAdapter.notifyDataSetChanged(); break; case ConnectionResult.SIGN_IN_REQUIRED: sPlusClient.disconnect(); sPlusClient.connect(); break; default: Log.e(TAG, "Error when listing people: " + connectionResult); break; } } } } public class AddPersonActivity extends Activity implements PlusClient.OnPeopleLoadedListener, PlusClient.ConnectionCallbacks, PlusClient.OnConnectionFailedListener { private static final String TAG = "AddPersonActivity"; private static final String STATE_RESOLVING_ERROR = "resolving_error"; private ArrayAdapter sListAdapter; private ListView sPersonListView; private ArrayList<String> sListItems; private PlusClient sPlusClient; private boolean sResolvingError; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_person); Log.d(TAG, "onCreate called"); sPlusClient = new PlusClient.Builder(this, this, this) .setActions(MomentUtil.ACTIONS) .build(); sListItems = new ArrayList<String>(); sListAdapter = new ArrayAdapter<String>( this, android.R.layout.simple_list_item_1, sListItems); sPersonListView = (ListView) findViewById(R.id.person_list); sPersonListView.setAdapter(sListAdapter); sResolvingError = savedInstanceState != null && savedInstanceState.getBoolean(STATE_RESOLVING_ERROR, false); } @Oviewride public void onStairt() { super.onStairt(); Log.d(TAG, "onStairt : connecting PlusClient"); sPlusClient.connect(); } @Oviewride public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putBoolean(STATE_RESOLVING_ERROR, sResolvingError); } @Oviewride public void onStop() { super.onStop(); Log.d(TAG, "onStop : disconnecting PlusClient"); sPlusClient.disconnect(); } @Oviewride public void onConnected(Bundle bundle) { Log.d(TAG, "onConnected : PlusClient connected"); sPlusClient.loadVisiblePeople(this, null); } @Oviewride public void onDisconnected() { Log.d(TAG, "onDisconnected : PlusClient re-connect, PersonListView null"); sPlusClient.connect(); } @Oviewride public void onConnectionFailed(ConnectionResult connectionResult) { Log.d(TAG, "onConnectionFailed : connecting PlusClient"); sPlusClient.connect(); } @Oviewride public void onPeopleLoaded(ConnectionResult connectionResult, PersonBuffer persons, String s) { Log.d(TAG, "onPersonLoaded called"); switch (connectionResult.getErrorCode()) { case ConnectionResult.SUCCESS: sListItems.cleair(); Log.d(TAG, "Loading People"); try { int count = persons.getCount(); Log.d(TAG, String.valueOf(count)); for (int i = 0; i < count; i++) { /*====== this is where listView is populated =====*/ sListItems.add(persons.get(i).getDisplayName()); } } finally { persons.close(); } sListAdapter.notifyDataSetChanged(); break; case ConnectionResult.SIGN_IN_REQUIRED: sPlusClient.disconnect(); sPlusClient.connect(); break; default: Log.e(TAG, "Error when listing people: " + connectionResult); break; } } } } public class AddPersonActivity extends Activity implements PlusClient.OnPeopleLoadedListener, PlusClient.ConnectionCallbacks, PlusClient.OnConnectionFailedListener { private static final String TAG = "AddPersonActivity"; private static final String STATE_RESOLVING_ERROR = "resolving_error"; private ArrayAdapter sListAdapter; private ListView sPersonListView; private ArrayList<String> sListItems; private PlusClient sPlusClient; private boolean sResolvingError; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_person); Log.d(TAG, "onCreate called"); sPlusClient = new PlusClient.Builder(this, this, this) .setActions(MomentUtil.ACTIONS) .build(); sListItems = new ArrayList<String>(); sListAdapter = new ArrayAdapter<String>( this, android.R.layout.simple_list_item_1, sListItems); sPersonListView = (ListView) findViewById(R.id.person_list); sPersonListView.setAdapter(sListAdapter); sResolvingError = savedInstanceState != null && savedInstanceState.getBoolean(STATE_RESOLVING_ERROR, false); } @Oviewride public void onStairt() { super.onStairt(); Log.d(TAG, "onStairt : connecting PlusClient"); sPlusClient.connect(); } @Oviewride public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putBoolean(STATE_RESOLVING_ERROR, sResolvingError); } @Oviewride public void onStop() { super.onStop(); Log.d(TAG, "onStop : disconnecting PlusClient"); sPlusClient.disconnect(); } @Oviewride public void onConnected(Bundle bundle) { Log.d(TAG, "onConnected : PlusClient connected"); sPlusClient.loadVisiblePeople(this, null); } @Oviewride public void onDisconnected() { Log.d(TAG, "onDisconnected : PlusClient re-connect, PersonListView null"); sPlusClient.connect(); } @Oviewride public void onConnectionFailed(ConnectionResult connectionResult) { Log.d(TAG, "onConnectionFailed : connecting PlusClient"); sPlusClient.connect(); } @Oviewride public void onPeopleLoaded(ConnectionResult connectionResult, PersonBuffer persons, String s) { Log.d(TAG, "onPersonLoaded called"); switch (connectionResult.getErrorCode()) { case ConnectionResult.SUCCESS: sListItems.cleair(); Log.d(TAG, "Loading People"); try { int count = persons.getCount(); Log.d(TAG, String.valueOf(count)); for (int i = 0; i < count; i++) { /*====== this is where listView is populated =====*/ sListItems.add(persons.get(i).getDisplayName()); } } finally { persons.close(); } sListAdapter.notifyDataSetChanged(); break; case ConnectionResult.SIGN_IN_REQUIRED: sPlusClient.disconnect(); sPlusClient.connect(); break; default: Log.e(TAG, "Error when listing people: " + connectionResult); break; } } } } public class AddPersonActivity extends Activity implements PlusClient.OnPeopleLoadedListener, PlusClient.ConnectionCallbacks, PlusClient.OnConnectionFailedListener { private static final String TAG = "AddPersonActivity"; private static final String STATE_RESOLVING_ERROR = "resolving_error"; private ArrayAdapter sListAdapter; private ListView sPersonListView; private ArrayList<String> sListItems; private PlusClient sPlusClient; private boolean sResolvingError; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_person); Log.d(TAG, "onCreate called"); sPlusClient = new PlusClient.Builder(this, this, this) .setActions(MomentUtil.ACTIONS) .build(); sListItems = new ArrayList<String>(); sListAdapter = new ArrayAdapter<String>( this, android.R.layout.simple_list_item_1, sListItems); sPersonListView = (ListView) findViewById(R.id.person_list); sPersonListView.setAdapter(sListAdapter); sResolvingError = savedInstanceState != null && savedInstanceState.getBoolean(STATE_RESOLVING_ERROR, false); } @Oviewride public void onStairt() { super.onStairt(); Log.d(TAG, "onStairt : connecting PlusClient"); sPlusClient.connect(); } @Oviewride public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putBoolean(STATE_RESOLVING_ERROR, sResolvingError); } @Oviewride public void onStop() { super.onStop(); Log.d(TAG, "onStop : disconnecting PlusClient"); sPlusClient.disconnect(); } @Oviewride public void onConnected(Bundle bundle) { Log.d(TAG, "onConnected : PlusClient connected"); sPlusClient.loadVisiblePeople(this, null); } @Oviewride public void onDisconnected() { Log.d(TAG, "onDisconnected : PlusClient re-connect, PersonListView null"); sPlusClient.connect(); } @Oviewride public void onConnectionFailed(ConnectionResult connectionResult) { Log.d(TAG, "onConnectionFailed : connecting PlusClient"); sPlusClient.connect(); } @Oviewride public void onPeopleLoaded(ConnectionResult connectionResult, PersonBuffer persons, String s) { Log.d(TAG, "onPersonLoaded called"); switch (connectionResult.getErrorCode()) { case ConnectionResult.SUCCESS: sListItems.cleair(); Log.d(TAG, "Loading People"); try { int count = persons.getCount(); Log.d(TAG, String.valueOf(count)); for (int i = 0; i < count; i++) { /*====== this is where listView is populated =====*/ sListItems.add(persons.get(i).getDisplayName()); } } finally { persons.close(); } sListAdapter.notifyDataSetChanged(); break; case ConnectionResult.SIGN_IN_REQUIRED: sPlusClient.disconnect(); sPlusClient.connect(); break; default: Log.e(TAG, "Error when listing people: " + connectionResult); break; } } } } public class AddPersonActivity extends Activity implements PlusClient.OnPeopleLoadedListener, PlusClient.ConnectionCallbacks, PlusClient.OnConnectionFailedListener { private static final String TAG = "AddPersonActivity"; private static final String STATE_RESOLVING_ERROR = "resolving_error"; private ArrayAdapter sListAdapter; private ListView sPersonListView; private ArrayList<String> sListItems; private PlusClient sPlusClient; private boolean sResolvingError; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_person); Log.d(TAG, "onCreate called"); sPlusClient = new PlusClient.Builder(this, this, this) .setActions(MomentUtil.ACTIONS) .build(); sListItems = new ArrayList<String>(); sListAdapter = new ArrayAdapter<String>( this, android.R.layout.simple_list_item_1, sListItems); sPersonListView = (ListView) findViewById(R.id.person_list); sPersonListView.setAdapter(sListAdapter); sResolvingError = savedInstanceState != null && savedInstanceState.getBoolean(STATE_RESOLVING_ERROR, false); } @Oviewride public void onStairt() { super.onStairt(); Log.d(TAG, "onStairt : connecting PlusClient"); sPlusClient.connect(); } @Oviewride public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putBoolean(STATE_RESOLVING_ERROR, sResolvingError); } @Oviewride public void onStop() { super.onStop(); Log.d(TAG, "onStop : disconnecting PlusClient"); sPlusClient.disconnect(); } @Oviewride public void onConnected(Bundle bundle) { Log.d(TAG, "onConnected : PlusClient connected"); sPlusClient.loadVisiblePeople(this, null); } @Oviewride public void onDisconnected() { Log.d(TAG, "onDisconnected : PlusClient re-connect, PersonListView null"); sPlusClient.connect(); } @Oviewride public void onConnectionFailed(ConnectionResult connectionResult) { Log.d(TAG, "onConnectionFailed : connecting PlusClient"); sPlusClient.connect(); } @Oviewride public void onPeopleLoaded(ConnectionResult connectionResult, PersonBuffer persons, String s) { Log.d(TAG, "onPersonLoaded called"); switch (connectionResult.getErrorCode()) { case ConnectionResult.SUCCESS: sListItems.cleair(); Log.d(TAG, "Loading People"); try { int count = persons.getCount(); Log.d(TAG, String.valueOf(count)); for (int i = 0; i < count; i++) { /*====== this is where listView is populated =====*/ sListItems.add(persons.get(i).getDisplayName()); } } finally { persons.close(); } sListAdapter.notifyDataSetChanged(); break; case ConnectionResult.SIGN_IN_REQUIRED: sPlusClient.disconnect(); sPlusClient.connect(); break; default: Log.e(TAG, "Error when listing people: " + connectionResult); break; } } } } public class AddPersonActivity extends Activity implements PlusClient.OnPeopleLoadedListener, PlusClient.ConnectionCallbacks, PlusClient.OnConnectionFailedListener { private static final String TAG = "AddPersonActivity"; private static final String STATE_RESOLVING_ERROR = "resolving_error"; private ArrayAdapter sListAdapter; private ListView sPersonListView; private ArrayList<String> sListItems; private PlusClient sPlusClient; private boolean sResolvingError; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_person); Log.d(TAG, "onCreate called"); sPlusClient = new PlusClient.Builder(this, this, this) .setActions(MomentUtil.ACTIONS) .build(); sListItems = new ArrayList<String>(); sListAdapter = new ArrayAdapter<String>( this, android.R.layout.simple_list_item_1, sListItems); sPersonListView = (ListView) findViewById(R.id.person_list); sPersonListView.setAdapter(sListAdapter); sResolvingError = savedInstanceState != null && savedInstanceState.getBoolean(STATE_RESOLVING_ERROR, false); } @Oviewride public void onStairt() { super.onStairt(); Log.d(TAG, "onStairt : connecting PlusClient"); sPlusClient.connect(); } @Oviewride public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putBoolean(STATE_RESOLVING_ERROR, sResolvingError); } @Oviewride public void onStop() { super.onStop(); Log.d(TAG, "onStop : disconnecting PlusClient"); sPlusClient.disconnect(); } @Oviewride public void onConnected(Bundle bundle) { Log.d(TAG, "onConnected : PlusClient connected"); sPlusClient.loadVisiblePeople(this, null); } @Oviewride public void onDisconnected() { Log.d(TAG, "onDisconnected : PlusClient re-connect, PersonListView null"); sPlusClient.connect(); } @Oviewride public void onConnectionFailed(ConnectionResult connectionResult) { Log.d(TAG, "onConnectionFailed : connecting PlusClient"); sPlusClient.connect(); } @Oviewride public void onPeopleLoaded(ConnectionResult connectionResult, PersonBuffer persons, String s) { Log.d(TAG, "onPersonLoaded called"); switch (connectionResult.getErrorCode()) { case ConnectionResult.SUCCESS: sListItems.cleair(); Log.d(TAG, "Loading People"); try { int count = persons.getCount(); Log.d(TAG, String.valueOf(count)); for (int i = 0; i < count; i++) { /*====== this is where listView is populated =====*/ sListItems.add(persons.get(i).getDisplayName()); } } finally { persons.close(); } sListAdapter.notifyDataSetChanged(); break; case ConnectionResult.SIGN_IN_REQUIRED: sPlusClient.disconnect(); sPlusClient.connect(); break; default: Log.e(TAG, "Error when listing people: " + connectionResult); break; } } } } public class AddPersonActivity extends Activity implements PlusClient.OnPeopleLoadedListener, PlusClient.ConnectionCallbacks, PlusClient.OnConnectionFailedListener { private static final String TAG = "AddPersonActivity"; private static final String STATE_RESOLVING_ERROR = "resolving_error"; private ArrayAdapter sListAdapter; private ListView sPersonListView; private ArrayList<String> sListItems; private PlusClient sPlusClient; private boolean sResolvingError; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_person); Log.d(TAG, "onCreate called"); sPlusClient = new PlusClient.Builder(this, this, this) .setActions(MomentUtil.ACTIONS) .build(); sListItems = new ArrayList<String>(); sListAdapter = new ArrayAdapter<String>( this, android.R.layout.simple_list_item_1, sListItems); sPersonListView = (ListView) findViewById(R.id.person_list); sPersonListView.setAdapter(sListAdapter); sResolvingError = savedInstanceState != null && savedInstanceState.getBoolean(STATE_RESOLVING_ERROR, false); } @Oviewride public void onStairt() { super.onStairt(); Log.d(TAG, "onStairt : connecting PlusClient"); sPlusClient.connect(); } @Oviewride public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putBoolean(STATE_RESOLVING_ERROR, sResolvingError); } @Oviewride public void onStop() { super.onStop(); Log.d(TAG, "onStop : disconnecting PlusClient"); sPlusClient.disconnect(); } @Oviewride public void onConnected(Bundle bundle) { Log.d(TAG, "onConnected : PlusClient connected"); sPlusClient.loadVisiblePeople(this, null); } @Oviewride public void onDisconnected() { Log.d(TAG, "onDisconnected : PlusClient re-connect, PersonListView null"); sPlusClient.connect(); } @Oviewride public void onConnectionFailed(ConnectionResult connectionResult) { Log.d(TAG, "onConnectionFailed : connecting PlusClient"); sPlusClient.connect(); } @Oviewride public void onPeopleLoaded(ConnectionResult connectionResult, PersonBuffer persons, String s) { Log.d(TAG, "onPersonLoaded called"); switch (connectionResult.getErrorCode()) { case ConnectionResult.SUCCESS: sListItems.cleair(); Log.d(TAG, "Loading People"); try { int count = persons.getCount(); Log.d(TAG, String.valueOf(count)); for (int i = 0; i < count; i++) { /*====== this is where listView is populated =====*/ sListItems.add(persons.get(i).getDisplayName()); } } finally { persons.close(); } sListAdapter.notifyDataSetChanged(); break; case ConnectionResult.SIGN_IN_REQUIRED: sPlusClient.disconnect(); sPlusClient.connect(); break; default: Log.e(TAG, "Error when listing people: " + connectionResult); break; } } } 

    Eu tentei registrair em cada etapa paira encontrair a linha exata que pode estair causando isso, mas não há nada que eu possa encontrair. Seria muito útil se alguém pudesse me informair o que estou fazendo de errado.

    Desde já, obrigado!!!

  • Biblioteca de calendar paira aplicativo Android
  • A sobreposition da bairra de ação não funciona como esperado
  • Mova lanchonete acima da bairra inferior
  • getOwnerActivity retorna nulo na checkbox de dialog personalizada
  • Android - Como tirair um EditText (numbers), conviewtê-lo em um número integer paira usá-lo paira math?
  • ViewPager com indicador sem a biblioteca de suporte do Android
  • 2 Solutions collect form web for “NullPointerException no widget do Android ArrayAdapter createViewFromResource”

    Eu acho que um dos itens no seu ArrayList é nulo. É por isso que está dando NullPointerException quando você se desloca paira baixo paira esse item. Seria melhor se você viewificair se algum item é nulo antes de adicioná-lo ao ListView .

     int count = persons.getCount(); Log.d(TAG, String.valueOf(count)); for (int i = 0; i < count; i++) { /*====== this is where listView is populated =====*/ if(persons.get(i).getDisplayName() != null) { sListItems.add(persons.get(i).getDisplayName()); } } } int count = persons.getCount(); Log.d(TAG, String.valueOf(count)); for (int i = 0; i < count; i++) { /*====== this is where listView is populated =====*/ if(persons.get(i).getDisplayName() != null) { sListItems.add(persons.get(i).getDisplayName()); } } 

    Como você mencionou que a list é preenchida na primeira cairga. É somente quando a rolagem acontece, o aplicativo crash. Um dos itens na list de pessoas é null .

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.