Thursday, January 28, 2010

Get Phone Contact Details

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;
    }

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(); 
        }

Communication with HttpRequest

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.



Features

Handset layouts
The platform is adaptable to larger, VGA, 2D graphics library, 3D graphics library based on OpenGL ES 1.0 specifications, and traditional smartphone layouts.
Storage
The Database Software SQLite is used for data storage purposes
Connectivity
Android supports connectivity technologies including GSM/EDGE, CDMA, EV-DO, UMTS, Bluetooth, and Wi-Fi.
Messaging
SMS and MMS are available forms of messaging including threaded text messaging.
Web browser
The web browser available in Android is based on the open-source WebKit application framework. The browser scores a 93/100 on the Acid3 Test.
Java support
Software written in Java can be compiled to be executed in the Dalvik virtual machine, which is a specialized VM implementation designed for mobile device use, although not technically a standard Java Virtual Machine.




Additional hardware support
Android can use video/still cameras, touchscreens, GPS, accelerometers, magnetometers, accelerated 2D bit blits (with hardware orientation, scaling, pixel format conversion) and accelerated 3D graphics.
Development environment
Includes a device emulator, tools for debugging, memory and performance profiling, a plugin for the Eclipse IDE.
Market
Like many phone-based application stores, the Android Market The Android Market has been expanding rapidly. By December, 2009, it had over 20,000 Android applications for download. is a catalog of applications that can be downloaded and installed to target hardware over-the-air, without the use of a PC. Originally only freeware applications were supported. Paid-for apps have been available on the Android Market in the United States since 19 February 2009.
Multi-touch
Android has native support for multi-touch which is available in newer handsets such as the HTC Hero. The feature was initially disabled at the kernel level (possibly to avoid infringing Apple patents on touch-screen technology).