dial_action不能得到解决或不是字段 [英] dial_action cannot be resolved or is not a field
问题描述
我试图执行一个示例应用意向,但我得到的Java文件这些错误:
DIAL_ACTION不能得到解决或不是字段搜索
NEW_TASK_LAUNCH不能得到解决或不是一个字段
块引用>下面是我的code:
包android_programmers_guide.AndroidTeleDial;进口android.app.Activity;
进口android.os.Bundle;
进口android.content.Intent;
进口android.net.Uri;
公共类AndroidTeleDial延伸活动{
/ **当第一次创建活动调用。 * /
@覆盖
公共无效的onCreate(捆绑savedInstanceState){
super.onCreate(savedInstanceState);
的setContentView(R.layout.main);
意图DialIntent =新意图(Intent.DIAL_ACTION,Uri.parse(电话:5551212));
DialIntent.setLaunchFlags(Intent.NEW_TASK_LAUNCH);
startActivity(DialIntent);
}
}
解决方案这是的 Intent.ACTION_DIAL 。
要避免这种错误,如果你使用Eclipse,使用自动完成功能:同时键入一个单词,preSS Ctrl +空格键,它就会打开尽可能完整的列表
这种方式,试图自动完成
Intent.DIAL
,你会发现,有没有这样的成员意图
类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 resolved or is not a fieldHere's my code:
package android_programmers_guide.AndroidTeleDial; import android.app.Activity; import android.os.Bundle; import android.content.Intent; import android.net.Uri; public class AndroidTeleDial extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Intent DialIntent=new Intent(Intent.DIAL_ACTION,Uri.parse("tel:5551212")); DialIntent.setLaunchFlags(Intent.NEW_TASK_LAUNCH); startActivity(DialIntent); } }
解决方案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 inIntent
class.这篇关于dial_action不能得到解决或不是字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!