I have CustomLayout class declared in a library customAndroidLibrary. This CustomLayout extends ViewGroup. Now I want to use this CustomLayout in my layout.xml which is in my project. I have included this library in my project.
CustomLayout class
package com.android.custom;
public class CustomLayout extends ViewGroup {
.....
}
layout.xml
<com.android.custom.CustomLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/animation_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
</com.android.custom.CustomLayout>
MainActivity
package com.android.ui;
public class MainActivity extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.layout);
}
}
But it is throwing ClassNotFoundException.
Even it is not detecting my Activity also if I am using the custom view in layout.xml
If I am using simple TextView in layout.xml. Then it is not giving any error.
Solved it on my own.