Android app crashes when I call mAdaper.notifyDataSetChanged();
<p>This is an app thats supposed to get the contacts from the phone and list the ones that have a phone number in a listview. 
But the app crashes when mAdaper.notifyDataSetChanged(); is called :/
please help. </p>

<pre><code>public class MainActivity extends Activity{
    static int num = 0;

    ListView lv;
    ArrayAdapter&lt;String&gt; mAdaper;
    ArrayList&lt;String&gt; contacts = new ArrayList&lt;String&gt;();


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        getContacts();

        lv = (ListView)findViewById(R.id.listView1);
        mAdaper = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, contacts);

        lv.setAdapter(mAdaper);

    }

    private void getContacts(){

        ContentResolver cr = getContentResolver();
        Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, // projection,
                null, // selection,
                null, // selectionArgs,
                "_ID DESC" // sortOrder
        );

        if (cur.getCount() &gt; 0) {
            while (cur.moveToNext() &amp;&amp; num &lt; 10) {
                String id = cur.getString(cur
                        .getColumnIndex(ContactsContract.Contacts._ID));
                String name = cur
                        .getString(cur
                                .getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
                if (Integer
                        .parseInt(cur.getString(cur
                                .getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER))) &gt; 0) {

                    // TableRow row = new TableRow(this);
                    TextView tv = new TextView(this);
                    String row = id + " - " + name;
                    contacts.add(row);
                    //mAdaper.add(row);
                    num++;

                }
            }
        }
        mAdaper.notifyDataSetChanged();

    }
</code></pre>
