Sunday, July 1, 2012

[android-developers] Calling sub-class getCursor() from main class problem

Hi I have this in my method calling getCursor() and is working ok within the class.
Now I try to call the method from the main class to perform some routine and  receive error:

"Cannot make a static reference to the non-static method getListAdapter() from the type ListActivity"

So I changed from:
Class B:
Cursor cursor = ((CursorAdapter) getListAdapter()).getCursor();

Change to:
Cursor cursor = ((CursorAdapter) ((ListActivity) mainContext).getListAdapter()).getCursor();

I can run and execute what I want in class B but if I call it outside in the main class I can't get the result.
No warning, nothing.

What is wrong?
Thanks

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment