Android Open Source - android-contacts-loader-demo Main Activity






From Project

Back to project page android-contacts-loader-demo.

License

The source code is released under:

Apache License

If you think the Android project android-contacts-loader-demo listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.codepath.examples.contactloader;
//from   w  w w. j av  a  2  s  .  com
import java.util.ArrayList;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.widget.ListView;

public class MainActivity extends Activity {
  ArrayList<Contact> listContacts;
  ListView lvContacts;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    listContacts = new ContactFetcher(this).fetchAll();
    lvContacts = (ListView) findViewById(R.id.lvContacts);
    ContactsAdapter adapterContacts = new ContactsAdapter(this, listContacts);
    lvContacts.setAdapter(adapterContacts);
  }

  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
  }

}




Java Source Code List

com.codepath.examples.contactloader.ContactEmail.java
com.codepath.examples.contactloader.ContactFetcher.java
com.codepath.examples.contactloader.ContactPhone.java
com.codepath.examples.contactloader.Contact.java
com.codepath.examples.contactloader.ContactsAdapter.java
com.codepath.examples.contactloader.MainActivity.java