代码如下
btnLineChat.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Intent intent = ChartFactory.getLineChartIntent(this, getChatDataSet(), getChatRenderer());
startActivity(intent);
}
});报错信息:The method getLineChartIntent(Context, XYMultipleSeriesDataset, XYMultipleSeriesRenderer) in the type ChartFactory is not applicable for the arguments (new View.OnClickListener(){}, XYMultipleSeriesDataset, XYMultipleSeriesRenderer)。这个该怎么处理呢?

解决方案 »

  1.   

    提示信息是在button的事件中不可用啊,要是想在Button的事件中可用的话该怎么操作呢
      

  2.   

    类型不匹配
    Intent intent = ChartFactory.getLineChartIntent(this, getChatDataSet(), getChatRenderer());
    这个this是View.OnClickListener类要外部类.this
      

  3.   

    但是官网提供的例子中有第一个参数也是直接用this的啊。
      

  4.   

    getLineChartIntent(Context, XYMultipleSeriesDataset, XYMultipleSeriesRenderer)
    getLineChartIntent的第一个参数是Context类型的你上面的this是View.OnClickListener类 
      

  5.   

    我换成外部类还是出错啊。btnLineChat.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View arg0) {
    // TODO Auto-generated method stub
    Intent intent = ChartFactory.getLineChartIntent(ChatActivity.class, getChatDataSet(), getChatRenderer());
    startActivity(intent);
    }
    });
      

  6.   

    外部类.this或直接Context对象才行
      

  7.   

    我跟楼主遇到同样的错误,在 getLineChartIntent 中的 context 参数,用外部类的 .this 也出错,有谁能解决这个问题吗?我愿意开帖给高分!
      

  8.   

    <activity android:name="org.achartengine.GraphicalActivity" />
    少了行这个 ,,刚刚解决的 ,,