Reputation: 171
Im keeping CustomScrollView inherited from HorizontalScrollView inside my MyActivity which extends FragmentActivity.While Running the App, it causes ClassNotFoundException - packagename.MyActivity.CustomScrollView not found!!...
How to solve this??
Thanx in advance!!
Upvotes: 1
Views: 1052
Reputation: 1303
You wanna refer to your custom scroll view as
<view class="packagename.MyActivity$CustomScrollView" />
Or possibly
<ViewGroup class="packagename.MyActivity$CustomScrollView" />
considering you're implementing a container. The reason it needs to be in a class attribute rather than the usual tag name style is that $ is needed to refer to nested classes, and $'s an illegal character in xml tag names.
Also note that MyActivity.CustomScrollView needs to be declared as public and static within MyActivity.
Upvotes: 1
Reputation: 6263
not packagename.MyActivity.CustomScrollView
try
packagename.MyActivity$CustomScrollView
You said CustomScrollView
is inside MyActivity
, right?
I think you want this:
<com.tabs.MyActivity$CustomScrollView
android:id="@+id/horizontalScrollView1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:scrollbars="none" >
</com.tabs.MyActivity$CustomScrollView>
notice the $
instead of the .
Upvotes: 0