Skip to content Skip to sidebar Skip to footer

Dial_action Cannot Be Resolved Or Is Not A Field

I have tried to execute a sample Intent application, but I am getting these errors in the java file: DIAL_ACTION cannot be resolved or is not a field NEW_TASK_LAUNCH cannot be r

Solution 1:

It's Intent.ACTION_DIAL.

To avoid this kind of errors, if you're using eclipse, use the auto-completion feature: while typing a word, press ctrl+space and it will open a list of possible completions.

This way, trying to auto complete Intent.DIAL you would find that there's no such member in Intent class.

Solution 2:

I don't think setLaunchFlags() is used any more. I think you just need to set the flag:

Intent.FLAG_ACTIVITY_NEW_TASK

And as @bigstones states, you should also use Intent.ACTION_DIAL.

Solution 3:

phone dialer example

Try this code.

package android_programmers_guide.AndroidPhoneDialer;

import android.app.Activity;
import android.os.Bundle;
import android.content.Intent;
import android.net.Uri;

publicclassAndroidPhoneDialerextendsActivity {
    /** Called when the activity is first created. */@OverridepublicvoidonCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        IntentDialIntent=newIntent(Intent.ACTION_DIAL,Uri.parse("tel:5551212"));
        DialIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(DialIntent);
    }
}

Post a Comment for "Dial_action Cannot Be Resolved Or Is Not A Field"