Android Open Source - Android---CSV-Contacts-Import Main Screen






From Project

Back to project page Android---CSV-Contacts-Import.

License

The source code is released under:

GNU General Public License

If you think the Android project Android---CSV-Contacts-Import 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.beforemadness;
//  w w  w  .j  av a 2 s  .c  om
import android.app.Activity;
import android.app.ListActivity;
import android.content.ContentValues;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.Contacts.People;
import android.widget.SimpleCursorAdapter;

public class MainScreen extends ListActivity {
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    listContacts();
  }
  
  public void listContacts() {
    
    String[] projection = new String[] {
        People.NAME,
        People.Phones._COUNT,
        People.PRIMARY_EMAIL_ID,
        People.NUMBER
    };
    
    Uri contacts = People.CONTENT_URI;
    Cursor managedCursor = managedQuery(contacts,projection,null,null,People.NAME + "ASC");
     String[] displayFields = new String[] {People.NAME, People.NUMBER};
    int[] displayViews = new int[] { android.R.id.text1, android.R.id.text2 };

    setListAdapter(new SimpleCursorAdapter(this, android.R.layout.simple_list_item_multiple_choice, managedCursor,displayFields, displayViews));
    
  }

}




Java Source Code List

com.beforemadness.CSVContactsImport.java
com.beforemadness.CheckedCursor.java
com.beforemadness.CheckedList.java
com.beforemadness.FileHelper.java
com.beforemadness.IContactType.java
com.beforemadness.MainScreen.java