android - define xml element from library class -



android - define xml element from library class -

i've library included project, , want define , element within xml file, element type class resides in library, when declares name gives me error through running :

<classtype android:id="@+id/my_view" android:layout_width="match_parent" android:layout_height="match_parent" />

and when declares view cast through run time i'm getting classcastexception :

<view android:id="@+id/my_view" android:layout_width="match_parent" android:layout_height="match_parent" />

then in java,

classtype my_view = (classtype) findviewbyid(r.id.my_view);

update:

the total log when trying add together whole namespace:

10-26 14:45:47.753: e/androidruntime(1430): fatal exception: main 10-26 14:45:47.753: e/androidruntime(1430): process: com.lockscreen, pid: 1430 10-26 14:45:47.753: e/androidruntime(1430): java.lang.runtimeexception: unable start activity componentinfo{com.lockscreen/com.lockscreen.lockscreenappactivity}: android.view.inflateexception: binary xml file line #8: error inflating class com.example.classtype 10-26 14:45:47.753: e/androidruntime(1430): @ android.app.activitythread.performlaunchactivity(activitythread.java:2195) 10-26 14:45:47.753: e/androidruntime(1430): @ android.app.activitythread.handlelaunchactivity(activitythread.java:2245) 10-26 14:45:47.753: e/androidruntime(1430): @ android.app.activitythread.access$800(activitythread.java:135) 10-26 14:45:47.753: e/androidruntime(1430): @ android.app.activitythread$h.handlemessage(activitythread.java:1196) 10-26 14:45:47.753: e/androidruntime(1430): @ android.os.handler.dispatchmessage(handler.java:102) 10-26 14:45:47.753: e/androidruntime(1430): @ android.os.looper.loop(looper.java:136) 10-26 14:45:47.753: e/androidruntime(1430): @ android.app.activitythread.main(activitythread.java:5017) 10-26 14:45:47.753: e/androidruntime(1430): @ java.lang.reflect.method.invokenative(native method) 10-26 14:45:47.753: e/androidruntime(1430): @ java.lang.reflect.method.invoke(method.java:515) 10-26 14:45:47.753: e/androidruntime(1430): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:779) 10-26 14:45:47.753: e/androidruntime(1430): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:595) 10-26 14:45:47.753: e/androidruntime(1430): @ dalvik.system.nativestart.main(native method) 10-26 14:45:47.753: e/androidruntime(1430): caused by: android.view.inflateexception: binary xml file line #8: error inflating class com.example.classtype 10-26 14:45:47.753: e/androidruntime(1430): @ android.view.layoutinflater.createview(layoutinflater.java:620) 10-26 14:45:47.753: e/androidruntime(1430): @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:696) 10-26 14:45:47.753: e/androidruntime(1430): @ android.view.layoutinflater.rinflate(layoutinflater.java:755) 10-26 14:45:47.753: e/androidruntime(1430): @ android.view.layoutinflater.inflate(layoutinflater.java:492) 10-26 14:45:47.753: e/androidruntime(1430): @ android.view.layoutinflater.inflate(layoutinflater.java:397) 10-26 14:45:47.753: e/androidruntime(1430): @ android.view.layoutinflater.inflate(layoutinflater.java:353) 10-26 14:45:47.753: e/androidruntime(1430): @ com.android.internal.policy.impl.phonewindow.setcontentview(phonewindow.java:290) 10-26 14:45:47.753: e/androidruntime(1430): @ android.app.activity.setcontentview(activity.java:1929) 10-26 14:45:47.753: e/androidruntime(1430): @ com.lockscreen.lockscreenappactivity.oncreate(lockscreenappactivity.java:75) 10-26 14:45:47.753: e/androidruntime(1430): @ android.app.activity.performcreate(activity.java:5231) 10-26 14:45:47.753: e/androidruntime(1430): @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1087) 10-26 14:45:47.753: e/androidruntime(1430): @ android.app.activitythread.performlaunchactivity(activitythread.java:2159) 10-26 14:45:47.753: e/androidruntime(1430): ... 11 more 10-26 14:45:47.753: e/androidruntime(1430): caused by: java.lang.reflect.invocationtargetexception 10-26 14:45:47.753: e/androidruntime(1430): @ java.lang.reflect.constructor.constructnative(native method) 10-26 14:45:47.753: e/androidruntime(1430): @ java.lang.reflect.constructor.newinstance(constructor.java:423) 10-26 14:45:47.753: e/androidruntime(1430): @ android.view.layoutinflater.createview(layoutinflater.java:594) 10-26 14:45:47.753: e/androidruntime(1430): ... 22 more 10-26 14:45:47.753: e/androidruntime(1430): caused by: java.lang.noclassdeffounderror: com.squareup.timessquare.r$styleable 10-26 14:45:47.753: e/androidruntime(1430): @ com.example.classtype.<init>(classtype.java:99) 10-26 14:45:47.753: e/androidruntime(1430): ... 25 more

put whole namespace

<com.library.namespace.classtype android:id="@+id/my_view" android:layout_width="match_parent" android:layout_height="match_parent" />

android xml android-library

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -