android - Android Intent使用情况(Call_action和new_task_

我在运行应用程序时遇到以下错误。
我的应用程序代码是

public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.main);
    final Button callButton = (Button) findViewById(R.id. callButton);
    callButton.setOnClickListener(new Button.OnClickListener()
    { 
      public void onClick(View v)
      {
          Intent callIntent = new Intent(Intent.CALL_ACTION,Uri.parse("tel:123456789"));
          callIntent.setLaunchFlags(Intent.NEW_TASK_LAUNCH);
          startActivity(callIntent);
       }
     });

   }

我面临的问题是CALL_ACTIONNEW_TASK_LAUNCH给我一个错误,通知我它们不是字段。谁能解决这个问题?

最佳答案

您只需写错了,显然,这不是一个字段。您没有在IDE中收到错误消息吗? CALL_ACTIVITY应该是ACTION_CALL,而NEW_TASK_LAUNCH应该是FLAG_ACTIVITY_NEW_TASK。请先阅读Documentation。

关于android - Android Intent使用情况(Call_action和new_task_launch),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8517523/

相关文章:

java - 保存一个整数onClick,以便以后可以在android应用中调用它

ios - Amazon IOS SDK : compiler warnings - ARC iss

flash - Flash编译器不允许覆盖

C++ - 清理后 Unresolved external symbol 错误

java - 即使定义了类和参数,Java也找不到符号错误?

ios - 导出版本时也出错,找不到iOS arm-apple-darwin9-as.exe

c++ - `invalid initialization of non-const referen

.net - 错误: “Expression must have class type” C++/C

android - Dalvik格式失败,在ServerAssistant上出现错误1

c++ - C++/LabVIEW互操作: error extracting data from L