On Tue, Jan 17, 2012 at 12:03 PM, Spiral123 <[email protected]> wrote:
> as part of updating my app I've decided to drag it into the 21st
> century and implement Drag and Drop on my ListView Fragment.

I'm not convinced that drag-and-drop is necessarily tied to being part
of the 21st century. :-)

> Noodling around for an easy way to do it I came across Mark Murphy's
> super handy TouchListView library as adapted from TouchInterceptor
> from the stock Music app.  I tried it out and the library works great
> in a regular app, but for some reason it refuses to work within any
> ListFragment.
>
> The line:
>
>    TouchListView tlv=(TouchListView)getListView();
>
> always causes a ClassCastException: 01-17 11:53:43.705: E/
> AndroidRuntime(25113): Caused by: java.lang.ClassCastException:
> android.widget.ListView cannot be cast to
> com.commonsware.cwac.tlv.TouchListView
>
> Needless to say TouchListView extends ListView.
>
> I spent some time working through this and in my testing I've found
> that:
> - It's nothing to do with TouchListView - creating my own custom
> ListView (that doesn't override anything from core) will generate the
> same error
>
> - It's not just my app: attaching the TouchListView library to the
> Google API Demos app and inserting the (TouchListView)getListView() in
> the FragmentsListArray code generates the same error.

That's strange. Are you using the Android Support package, or native
fragments? And, can you put together a sample app that demonstrates
the problem, so I can try it out here?

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 3.7 Available!

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

Reply via email to