2011-12-15 66 views
0

我在运行我的应用程序时遇到以下错误。 我的应用程序的代码是Android意图使用(Call_action&new_task_launch)

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_ACTION和NEW_TASK_LAUNCH是给了我一个错误,通知我说,他们并不领域的问题。任何人都可以解决这个问题。

在此先感谢。

+0

如果你接受更多的答案,你可能会得到更多的答案...... – coder 2011-12-15 19:25:39

回答

0

你只是写错了,显然它不是一个领域。你没有在你的IDE中收到错误信息吗? CALL_ACTIVITY应该ACTION_CALL和NEW_TASK_LAUNCH应FLAG_ACTIVITY_NEW_TASK请阅读Documentation第一

+0

它不是那家伙的错,如果一些灌洗在谷歌决定重新命名他们的常量。 http://developer.android.com/guide/faq/framework.html#4 – kellogs 2012-09-23 13:28:14