Android AlertDialog.Builder方法没有定义getContext()

时间:2013-01-25 20:21:46

标签: android dialog undefined

AlertDialog.Builder的参考页面列出了API 11+的getContext()方法,但此代码:

public void onCreate(Bundle savedInstanceState) 
{
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);

    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    LayoutInflater inflater = LayoutInflater.from(builder.getContext());
}

将在Eclipse中显示错误:

 The method getContext() is undefined for the type AlertDialog.Builder

但我使用的是API级别15,所以我认为它可用。任何人都可以看到问题所在吗?

0 个答案:

没有答案