Cannot Cast From ListView to PullToRefreshListView
alexfu opened this issue · 10 comments
I pulled the exact same sample code that you have and it seems as though using the following does not work...
((PullToRefreshListView) getListView()).setOnRefreshListener(new OnRefreshListener() {
@OverRide
public void onRefresh() {
// Do work to refresh the list here.
new GetDataTask().execute();
}
});
Is this a known issue already? Using findViewById() seems to be the only workaround.
Are you testing the example project, is the library referenced correct and on which device and Android version is this on?
Yes... It is the example project. I am targeting 2.3.3 in the Eclipse project, I have it referencing the library correctly. I also targeted other API levels and that didnt do anything. It works if I change the ID (so that it'll show up when looking it up via R.id) of the PullToRefreshListView and get it via findViewById()
I have a screen shot here: http://i43.tinypic.com/29c86f8.png
Have you changed the XML to reference the new package name as well? I've noticed that you renamed the package so I just want to be sure.
Yes, package names & references are correct.
The sample works fine here from 1.6 to 4.0+. Since you've changed the package there might be something else you've missed to change. Not sure how you've set up the project but from the screenshot it looks like the library isn't linked correctly as a library project.
The pulltorefresh project is setup to be a library project in my setup. I'm not sure what else there needs to be done. I haven't changed the package names in anyway, just the project name, which shouldn't have any effect on the library.
Well I have the same code running fine here, might be an issue with the environment? Tried with the latest Eclipse plugin? Here's a shot of my project setup in Eclipse, http://oi43.tinypic.com/otg7l0.jpg.
I figured out the problem... The original package was named: com.hallmark... but now it has completely changed to com.markupartist....
When did this happen?
Awesome! For the package name, it has always been com.markupartist. Maybe you based your initial work on a fork that changed the package? Closing this ticket now.
Hm.. oh well haha. That was my fault.