private void getMyPhoneNumber(){
// Form an array specifying which columns to return.
try{
String[] projection = new String[] {
People._ID,
People.LABEL,//._COUNT,
People.NAME,
People.NUMBER,
People.PRIMARY_EMAIL_ID
};
// Get the base URI for the People table in the Contacts content provider.
Uri contacts = People.CONTENT_URI;
// Make the query.
Cursor managedCursor = managedQuery(contacts,
projection, // Which columns to return
null, // Which rows to return (all rows)
null, // Selection arguments (none)
// Put the results in ascending order by name
People.NAME + " ASC");
alertbox("Contacts", getColumnData(managedCursor));
}
catch(Exception e){
alertbox("Exception", e.getMessage());
}
}
private String getColumnData(Cursor cur){
String ContactsName="";
if (cur.moveToFirst()) {
String name;
String phoneNumber;
String email;
String Label;
int nameColumn = cur.getColumnIndex(People.NAME);
int phoneColumn = cur.getColumnIndex(People.NUMBER);
String imagePath;
do {
// Get the field values
name = cur.getString(nameColumn);
phoneNumber = cur.getString(phoneColumn);
email =cur.getString(cur.getColumnIndex(People.PRIMARY_EMAIL_ID));
Label =cur.getString(cur.getColumnIndex(People.LABEL));
ContactsName+="name:"+name+" Phoneno:"+phoneNumber+"email:"+email+"label:"+Label;
} while (cur.moveToNext());
}
return ContactsName;
}
Thursday, January 28, 2010
Friday, January 15, 2010
Alert box in Android
As as java script we show a alert dailoge box.
Java Code:
protected void alertbox(String title, String mymessage)
{
new AlertDialog.Builder(this)
.setMessage(mymessage)
.setTitle(title)
.setCancelable(true)
.setNeutralButton(android.R.string.cancel,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton){}
})
.show();
}
{
new AlertDialog.Builder(this)
.setMessage(mymessage)
.setTitle(title)
.setCancelable(true)
.setNeutralButton(android.R.string.cancel,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton){}
})
.show();
}
Wednesday, January 13, 2010
What is Android
Android is a mobile operating system running on the Linux kernel. It was initially developed by Android Inc., a firm later purchased by Google, and lately by the Open Handset Alliance. It allows developers to write managed code in the Java language, controlling the device via Google-developed Java libraries.
The unveiling of the Android distribution on 5 November 2007 was announced with the founding of the Open Handset Alliance, a consortium of hardware, software, and telecom companies devoted to advancing open standards for mobile devices.Google released most of the Android code under the Apache License, a free software and open source license.
The unveiling of the Android distribution on 5 November 2007 was announced with the founding of the Open Handset Alliance, a consortium of hardware, software, and telecom companies devoted to advancing open standards for mobile devices.Google released most of the Android code under the Apache License, a free software and open source license.
Features
Subscribe to:
Posts (Atom)