hi megha, i made my program into a service - i have extras for my intent, so i hope the ibind is the place to pick the extras up - the only thing that is hanging now is that
startManagingCursor(c); is showing an error of "the method startManagingCursor(Cursor) is undefined for the type GetContacts" here is GetContacts as a service package org.apache.android.mailContactsOften; import org.apache.android.mailContactsOften.GetContacts; import android.app.Service; import android.app.Activity; import android.app.NotificationManager; import android.database.Cursor; import android.os.Binder; import android.os.Bundle; import android.os.IBinder; import android.os.Parcel; import android.content.ContentResolver; import android.content.Intent; public class GetContacts extends Service { String pList = ""; String st = ""; String userid ; String password ; String email ; int rbutton ; String body; @Override protected void onCreate() { Thread thr = new Thread(null, mTask, "GetContacts"); thr.start(); } /** * The function that runs in our worker thread */ Runnable mTask = new Runnable() { public void run() { // Normally we would do some work here... // get the contact string and call send to send the info body = getContactStr(); // send the data SendContacts s = new SendContacts (body,userid, password, email,rbutton); // Done with our work... stop the service! GetContacts.this.stopSelf(); } }; @Override public IBinder onBind(Intent intent) { userid = intent.getStringExtra("userid"); password = intent.getStringExtra("password"); email = intent.getStringExtra("email"); int foo=0; rbutton = intent.getIntExtra("rbutton", foo); body = intent.getStringExtra("body"); return mBinder; } /** * This is the object that receives interactions from clients. See RemoteService * for a more complete example. */ private final IBinder mBinder = new Binder() { @Override protected boolean onTransact(int code, Parcel data, Parcel reply, int flags) { return super.onTransact(code, data, reply, flags); } }; public String getContactStr() { pList = ""; st = ""; Cursor c = getContentResolver().query( android.provider.Contacts.Phones.CONTENT_URI, null, null, null, android.provider.Contacts.Phones.PERSON_ID+ " ASC"); startManagingCursor(c); .....rest of routine } here is the new receiver package org.apache.android.mailContactsOften; import android.content.Context; import android.content.Intent; import android.content.IntentReceiver; public class EmailContactsRepeat extends IntentReceiver { @Override public void onReceiveIntent(Context context, Intent intent) { //get bundle of extras (userid, passwork, email) from intent String userid = intent.getStringExtra("userid"); String password = intent.getStringExtra("password"); String email = intent.getStringExtra("email"); int foo=0; int rbutton = intent.getIntExtra("rbutton", foo); String body = intent.getStringExtra("body"); //context.startService(new Intent(context, GetContacts.class), // null); Intent conintent = new Intent(context, GetContacts.class); //bundle data for conintent // bundle extras (data) with the intent. conintent.putExtra("userid", userid); conintent.putExtra("password", password); conintent.putExtra("email", email); conintent.putExtra("rbutton", rbutton); conintent.putExtra("body",body); context.startService(conintent,null); } } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---