Retrieve HOME Contact Number from address book

by mike » Wed, 21 Apr 2010 17:10:29 GMT


Sponsored Links
 i guys,

currently i have a application which will retrieve all the contact
details and will display all the available Contact Names in a
SimpleCursorAdapter.

so once user select a particular name number will be displayed. which
works fine.

but now i want to display HOME and WORK numbers if available. how can
i achieve this?

below is my class

public class ConL extends ListActivity {
private SimpleCursorAdapter myAdapter;
TextView stat;

@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
stat = (TextView) findViewById(R.id.label);
viewContacts();
}

public void viewContacts() {
Cursor cursor = getContentResolver().query(People.CONTENT_URI,
null,
null, null, People.NAME + " ASC");
startManagingCursor(cursor);
int x = cursor.getCount();
if (cursor == null || x == 0) {
alert("Address Book", "Empty Address Book");
}
String[] columns = new String[] { People.NAME };
int[] names = new int[] { R.id.label };
myAdapter = new SimpleCursorAdapter(this, R.layout.test, cursor,
columns, names);
setListAdapter(myAdapter);
}

public void alert(String header, String body) {
new AlertDialog.Builder(this).setTitle(header).setMessage(body)
.setCancelable(true).setNeutralButton("Close",
new
DialogInterface.OnClickListener() {

@Override
public void
onClick(DialogInterface dialog,
int
which) {
// TODO
Auto-generated method stub
}
}).show();
}

protected String[] isAssigned(String[] str) {
String[] assign = null;
for (int i = 0; i < str.length; i++) {
Cursor cur = managedQuery(People.CONTENT_URI, null,
People.NAME
+ "='" + str[i] + "'", null, null);
if (cur != null) {
if (cur.moveToFirst()) {
String title;
// String phoneNumber;
int nameColumn =
cur.getColumnIndex(People.NUMBER);
// int phoneColumn =
cur.getColumnIndex(People.NUMBER);
// String imagePath;
do {
// Get the field values

} while (cur.moveToNext());
}
}
}
return assign;
}

@Overri



Retrieve HOME Contact Number from address book

by mike » Wed, 21 Apr 2010 17:16:26 GMT


 i guys,

currently i have a application which will retrieve all the contact
details and will display all the available Contact Names in a
SimpleCursorAdapter.

so once user select a particular name number will be displayed. which
works fine.

but now i want to display HOME and WORK numbers if available. how can
i achieve this?

below is my class

public class ConL extends ListActivity {
private SimpleCursorAdapter myAdapter;
TextView stat;

@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
stat = (TextView) findViewById(R.id.label);
viewContacts();
}

public void viewContacts() {
Cursor cursor = getContentResolver().query(People.CONTENT_URI,
null,
null, null, People.NAME + " ASC");
startManagingCursor(cursor);
int x = cursor.getCount();
if (cursor == null || x == 0) {
alert("Address Book", "Empty Address Book");
}
String[] columns = new String[] { People.NAME };
int[] names = new int[] { R.id.label };
myAdapter = new SimpleCursorAdapter(this, R.layout.test, cursor,
columns, names);
setListAdapter(myAdapter);
}

public void alert(String header, String body) {
new AlertDialog.Builder(this).setTitle(header).setMessage(body)
.setCancelable(true).setNeutralButton("Close",
new
DialogInterface.OnClickListener() {

@Override
public void
onClick(DialogInterface dialog,
int
which) {
// TODO
Auto-generated method stub
}
}).show();
}

protected String[] isAssigned(String[] str) {
String[] assign = null;
for (int i = 0; i < str.length; i++) {
Cursor cur = managedQuery(People.CONTENT_URI, null,
People.NAME
+ "='" + str[i] + "'", null, null);
if (cur != null) {
if (cur.moveToFirst()) {
String title;
// String phoneNumber;
int nameColumn =
cur.getColumnIndex(People.NUMBER);
// int phoneColumn =
cur.getColumnIndex(People.NUMBER);
// String imagePath;
do {
// Get the field values

} while (cur.moveToNext());
}
}
}
return assign;
}

@Overri


Sponsored Links


Other Threads

1. Help me: My emulator reported an error that "com.android.settings has no certificates at entry AndroidManifest.xml"

Hi,

I did some modification about the java code and AndroidManifest.xml of
"com.android.settings" package.
Then I ran the emulator like this:
make;
lunch 1;
emulator &

When PackageManagerService was scanning the "/system/app/Settings.apk"
packages at boot time, it reported an error that "com.android.settings
has no certificates at entry AndroidManifest.xml".

I guess my modified "Settings.apk" could not pass the signature
verify. How can I run my modified "Settings.apk" successfully?
Could anybody help me?

Thanks,
yagbu

--~--~---------~--~----~------------~-------~--~----~

2. Ice for Android.How to connect via IceSSL plugin?

Hi All.
I'm trying to make SSL connection from Android to server. I'm using
standart SSL certificates from Ice.

SSL configuration on server side
Ice.Plugin.IceSSL=IceSSL:createIceSSL
IceSSL.CertAuthFile=cacert.pem
IceSSL.CertFile=s_rsa1024_pub.pem
IceSSL.KeyFile=s_rsa1024_priv.pem


Client code:
        initData.properties = Ice.Util.createProperties();
        initData.properties.setProperty("Ice.ACM.Client", "0");
        initData.properties.setProperty("Ice.RetryIntervals", "-1");
        initData.properties.setProperty("Ice.Trace.Network", "0");
        initData.properties.setProperty("Ice.Plugin.IceSSL",
"IceSSL.PluginFactory");
        initData.properties.setProperty("IceSSL.Trace.Security", "1");
        initData.properties.setProperty("IceSSL.DefaultDir", "/data/
data/serts");
        initData.properties.setProperty("IceSSL.CertAuthFile",
"cacert.pem");
        initData.properties.setProperty("IceSSL.CertFile",
"c_rsa1024_pub.pem");
        initData.properties.setProperty("IceSSL.KeyFile",
"c_rsa1024_priv.pem");
        initData.properties.setProperty("IceSSL.Password",
"password");
        _communicator = Ice.Util.initialize(initData);

In LogCat only:
OpenSSLSocketImpl - Unknown error 1 during connect

Message from server:
error:140890C7:SSL routines:SSL3_GET_CLIENT_CERTIFICATE:peer did not
return a certificate

Python client is connecting to this server normally. Could anybody say
my where i made mistake?

Thanks.

--~--~---------~--~----~------------~-------~--~----~

3. Not able to connect device using adb -d shell command from vista

4. Activity launch timeout even with wakelock

5. Not able to connect device using adb -d shell command from vista

6. arrays to be accessed by both JAVA n C thru JNI in an Android app

7. (Root) update to rc33