我正在处理来自Git-hub 的众所周知的拉动刷新示例
我加载了库,一切正常,但是当我想调用方法 setOnRereshListener 时,Eclipse 找不到它。可能是什么问题?
这是来自示例的代码:
PullToRefreshListView pullToRefreshView = (PullToRefreshListView) findViewById(R.id.pull_to_refresh_listview);
pullToRefreshView.setOnRefreshListener(new OnRefreshListener<ListView>() {
@Override
public void onRefresh(PullToRefreshBase<ListView> refreshView) {
// Do work to refresh the list here.
new GetDataTask().execute();
}
});
这是我的代码:
public class MainActivity extends Activity {
private static final String URL = "http://192.168.1.103/php-android/testphp.php";
private static final String TAG_DATA = "data";
private static final String TAG_ID = "name";
private static final String TAG_DATE = "date";
public PullToRefreshListView listView;
JSONArray data = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder() .detectAll().penaltyLog().build();
StrictMode.setThreadPolicy(policy);
getDataInArray();
PullToRefreshListView pullToRefreshView = (PullToRefreshListView) findViewById(R.id.pull_to_refresh_listview);
pullToRefreshView.setOnRefreshListener(new OnRefreshListener<ListView>() {
@Override
public void onRefresh(PullToRefreshBase<ListView> refreshView) {
// Do work to refresh the list here.
new GetDataTask().execute();
}
});
}