Hello, I've take part of the ColorPicker code from APIDemo to make a custom View in a separate class. Just now I can create this view and set as content from code and it works. The problem comes when I want to do it from xml file.
The error says that it cannot find the 2 argument's constructor for the class, but it is in the class... So I don't understand why am I getting this error... This is the main.xml <?xml version="1.0" encoding="utf-8"?> <com.mipixel.rgblamp.ColorPickerView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/colorPicker" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_gravity="center_horizontal|center" /> Here is the ColorPickerView.java: http://pastebin.com/t7Rd9KLJ And here the activity code: http://pastebin.com/rwSB0dTk This is the error LogCat: 04-24 04:03:58.231: ERROR/AndroidRuntime(12529): Uncaught handler: thread main exiting due to uncaught exception 04-24 04:03:58.391: ERROR/AndroidRuntime(12529): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mipixel.rgblamp/com.mipixel.rgblamp.RGBLamp}: android.view.InflateException: Binary XML file line #2: Error inflating class com.mipixel.rgblamp.ColorPickerView 04-24 04:03:58.391: ERROR/AndroidRuntime(12529): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 2503) 04-24 04:03:58.391: ERROR/AndroidRuntime(12529): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: 2519) 04-24 04:03:58.391: ERROR/AndroidRuntime(12529): at android.app.ActivityThread.access$2200(ActivityThread.java:123) 04-24 04:03:58.391: ERROR/AndroidRuntime(12529): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1870) 04-24 04:03:58.391: ERROR/AndroidRuntime(12529): at android.os.Handler.dispatchMessage(Handler.java:99) 04-24 04:03:58.391: ERROR/AndroidRuntime(12529): at android.os.Looper.loop(Looper.java:123) 04-24 04:03:58.391: ERROR/AndroidRuntime(12529): at android.app.ActivityThread.main(ActivityThread.java:4370) 04-24 04:03:58.391: ERROR/AndroidRuntime(12529): at java.lang.reflect.Method.invokeNative(Native Method) 04-24 04:03:58.391: ERROR/AndroidRuntime(12529): at java.lang.reflect.Method.invoke(Method.java:521) 04-24 04:03:58.391: ERROR/AndroidRuntime(12529): at com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:868) 04-24 04:03:58.391: ERROR/AndroidRuntime(12529): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 04-24 04:03:58.391: ERROR/AndroidRuntime(12529): at dalvik.system.NativeStart.main(Native Method) 04-24 04:03:58.391: ERROR/AndroidRuntime(12529): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class com.mipixel.rgblamp.ColorPickerView 04-24 04:03:58.391: ERROR/AndroidRuntime(12529): at android.view.LayoutInflater.createView(LayoutInflater.java:503) 04-24 04:03:58.391: ERROR/AndroidRuntime(12529): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565) 04-24 04:03:58.391: ERROR/AndroidRuntime(12529): at android.view.LayoutInflater.inflate(LayoutInflater.java:385) 04-24 04:03:58.391: ERROR/AndroidRuntime(12529): at android.view.LayoutInflater.inflate(LayoutInflater.java:320) 04-24 04:03:58.391: ERROR/AndroidRuntime(12529): at android.view.LayoutInflater.inflate(LayoutInflater.java:276) 04-24 04:03:58.391: ERROR/AndroidRuntime(12529): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java: 198) 04-24 04:03:58.391: ERROR/AndroidRuntime(12529): at android.app.Activity.setContentView(Activity.java:1625) 04-24 04:03:58.391: ERROR/AndroidRuntime(12529): at com.mipixel.rgblamp.RGBLamp.onCreate(RGBLamp.java:22) 04-24 04:03:58.391: ERROR/AndroidRuntime(12529): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java: 1047) 04-24 04:03:58.391: ERROR/AndroidRuntime(12529): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 2466) 04-24 04:03:58.391: ERROR/AndroidRuntime(12529): ... 11 more 04-24 04:03:58.391: ERROR/AndroidRuntime(12529): Caused by: java.lang.NoSuchMethodException: ColorPickerView(Context,AttributeSet) 04-24 04:03:58.391: ERROR/AndroidRuntime(12529): at java.lang.Class.getMatchingConstructor(Class.java:674) 04-24 04:03:58.391: ERROR/AndroidRuntime(12529): at java.lang.Class.getConstructor(Class.java:486) 04-24 04:03:58.391: ERROR/AndroidRuntime(12529): at android.view.LayoutInflater.createView(LayoutInflater.java:475) 04-24 04:03:58.391: ERROR/AndroidRuntime(12529): ... 20 more 04-24 04:03:58.591: ERROR/SemcCheckin(12529): Get crash dump level : java.io.FileNotFoundException: /data/semc-checkin/crashdump 04-24 04:03:59.011: ERROR/SemcCheckin(1748): Get Crash Level : java.io.FileNotFoundException: /data/semc-checkin/crashdump Any help is appreciated. Thank you. -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en