Friday, May 24, 2013

[android help] Pull to refresh example, Eclipse don't find setOnRefreshListener command


iam dealing with well known pull to refresh example from Git-hub


I loaded library and everything is working as it should but when i want to call method setOnRereshListener, Eclipse don't find it. What could be a problem?


This is code from example:



PullToRefreshListView pullToRefreshView = (PullToRefreshListView) findViewById(R.id.pull_to_refresh_listview);
pullToRefreshView.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh(PullToRefreshBase refreshView) {
// Do work to refresh the list here.
new GetDataTask().execute();
}
});


And this is my code:



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() {
@Override
public void onRefresh(PullToRefreshBase refreshView) {
// Do work to refresh the list here.
new GetDataTask().execute();
}
});
}


.

stackoverflow.comm

No comments:

Post a Comment

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...