How to call someone by shaking my mobile?

I've a project where i want to make Shake method that works for calling when i shake my mobile in three times .But i faced problem.I want to pick up a number from my contact list by pressing a button and successfully make this by implement onActivityResult Override method.

@Override

protected void onActivityResult(int requestCode, int resultCode, Intent data) {

super.onActivityResult(requestCode, resultCode, data);

if (requestCode == PICK_CONTACT) {

if (resultCode == AppCompatActivity.RESULT_OK) {

Uri contactData = data.getData();

Cursor cursor = getContentResolver().query(contactData, null, null, null, null);

if (cursor.moveToFirst()) {

String name = cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.Contacts.DISPLAY_NAME));

//System.out.print(name);

Intent intent = new Intent(this, MainActivity.class);

intent.putExtra("call", "name");

Toast.makeText(this, "You've picked...

Read More »

By: StackOverFlow - Friday, 9 November

Related Posts