I am using the droidQuery library to add some gesture detection to my app. I was having trouble adding the SwipeInterceptorView in my xml file (see original question here, so I define it inside my onCreate
method and give it the same parameters. Then I add it to my layout using layout.addView(swipeInterceptorView)
. I attempted to add it to my XML
layout file, but I got an error.
Is defining the SwipeInterceptorView
programatically good practice, or should I add it to my XML
file? If I should, how can I fix this XML
file? :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/table"
android:orientation="vertical" >
<self.philbrown.SwipeInterceptorView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipe_view"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</self.philbrown.SwipeInterceptorView>
<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
When I use this layout, I get the Runtime error java.lang.ClassNotFoundException
.
Also, i know how to add the onClickListener
to an ImageView
, but could anyone tell me how I should add the listener to a TextView
also?
Thanks for any help!