I'm trying to send a message via whatsapp it automatically, I think part of the code is correct, because achievement retrieve the name of the contact that you want to send, but I skip a "Debug Current Instruction Pointer" in a method that no is that it serves, was "instrumentation.class" and is the method
thanks
Code:
public final boolean queueIdle ()
{
synchronized (msync)
{
mWaitingActivities.remove (mWaiter);
mSync.notifyAll ();
}
return false;
}
my code is as follows:
public void onClickWhatsApp (View v)
{
Cursor c = getContentResolver().query(ContactsContract.Data.CONTENT_URI,
new String[] { ContactsContract.Contacts.Data._ID },
ContactsContract.Data.DATA1 + "=?",
new String[] { "mynumber@s.whatsapp.net" }, null);
if (c==null)
{
tV1.setText("nll");
}
c.moveToFirst();
if (c!=null)
{
tV1.setText(c.getString(0));
}
Intent i = new Intent(Intent.ACTION_SENDTO, Uri.parse("content://com.android.contacts/data/" + c.getString(0)));
i.setType("text/plain");
String text = "my txt";
i.setPackage("com.whatsapp"); // so that only Whatsapp reacts and not the chooser
i.putExtra(Intent.EXTRA_TEXT, text);
startActivity(i);
c.close();
}
thanks