How can i fetch builtin contacts in mobile...?

by android.vinny » Fri, 07 Aug 2009 17:17:51 GMT


Sponsored Links
 Hi
I need to fetch all the built in contacts we added in contacts app....
How is it possible ....to fetch the contacts

Can any body suggest me regarding this ...

TAI

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



How can i fetch builtin contacts in mobile...?

by Stefan » Fri, 07 Aug 2009 20:04:32 GMT


 Hi,

take a look on the source codes from the book "professional android
application development" from reto meier.
you can download it from this page:
 http://media.wiley.com/product_ancillary/17/04703447/DOWNLOAD/Download %20code%20for%20Professional%20Android.zip
unzip the file and then browse to Chapter5_Sample_ContactPicker.zip an
unzip this again.

I hope I could help you.

Regards,
Stefan



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


Sponsored Links


Other Threads

1. MultiCast RX Problem

Good afternoon,

Platform is DROID X running V2.2OS.  Have successfully connected to
Multicast server and am receiving broadcasts for a period of a period
of time (15-30 seconds) after which the receive function times out and
no other data is received.  I can confirm the Multicast broadcast
remains active.  Additionally, a restart of the application permits
reception of broadcast again (once again for about 15-30 seconds).
Broadcast is a simple text string approximately 30 ASCII characters
about 20 times a second.

Receive function is implemented in a separate thread as the Multicast
receive function is a blocking function.

If receive function is placed in main thread, this behavior does not
occur (i.e., I receive broadcasts indefinitely).  However, I cannot
keep it in the main thread as there are a series of Multicast
receivers required for the application.

Have also tried numerous threading implementations (runnable, callable
as defined below) as well as extremely large buffers.  It appears (and
this is purely an observation of the behavior, not a diagnosis) that
the network stack somehow fails to de-allocate memory on each receive
and that eventually is corrupted.

Code Follows...

Any thoughts or help is greatly appreciated.  Thanks in advance.

ME


public class Video1 extends Activity
{
    MulticastSocket TheSocket;
    final Handler mHandler = new Handler();

    // Create runnable for posting
    final Runnable mUpdateResults = new Runnable()
    {
        public void run()
        {
            updateResultsInUi();
        }
    };

    protected void CompassReceive()
    //    final Runnable CompassReceive = new Runnable()
    {
        Thread t = new Thread()
        {
                public void run()
                {
                        int idx;
                        byte[] buf = new byte[256];
                        boolean rcvd = false;

                        String response = "";
                        DatagramPacket packet = new 
DatagramPacket(buf,buf.length);
                        for (idx = 0 ; idx < buf.length ; idx++)
                                buf[idx] = 0;

                        try
                        {
                                rcvd = false;
                                TheSocket.receive(packet);
                                response = new String(packet.getData()).trim();
                                System.out.println("DEBUG: 
Listener.doInBackground: Received:
"+packet.getAddress()+" "+packet.getPort()+" "+response);
                                rcvd = true;
                        }
                        catch (Exception e)
                        {
                                System.out.println("DEBUG: Rx Timeout");
                                rcvd = false;
                        };
                        mHandler.post(mUpdateResults);
                }
        };
        t.start();
    };

    private void updateResultsInUi()
    {
                CompassReceive();

    }

    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        WifiManager wifi =
(WifiManager)getSystemService(getApplicationContext().WIFI_SERVICE);
        MulticastLock lock = wifi.createMulticastLock("mylock");
        lock.acquire();


        int port = 9050;
        String group = "224.100.0.1";
        try
        {
                TheSocket = new MulticastSocket(new InetSocketAddress(port));
                TheSocket.joinGroup(InetAddress.getByName(group));
                TheSocket.setReuseAddress(true);
                TheSocket.setSoTimeout(2000);
        }
        catch (Exception e)
        {

        };

        CompassReceive();
    }
}



-- 

2. disable functionality if required external libraries are not installed

Is it possible to install an application that requires external
libraries in a device without external libraries installed disabling
associated functionality in Android 1.5?
For example, I've an application with multiple activities. Only one
activity is a MapActivity, it requires Google API. Can I disable
MapActivity when it is not supported by the device and let the user
install the application?

StackOverflow's related question:
http://stackoverflow.com/questions/3909903/disable-mapview-if-it-is-not-supported

Thanks in advance.

-- 

3. Channel Frequency API & String ???

4. About Device Policy Manager

5. Singleton object with context?

6. How to make linkable TextView with Linkify

7. Boot Animation Sound (2.1)