signal-strength-view
signal-strength-view copied to clipboard
Exception in layout editor
When I try to use this component I always get this message in layout editor:
The following classes could not be instantiated: -Â eo.view.signalstrength.SignalStrengthView (Open Class, Show Exception, Clear Cache) Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE. If this is an unexpected error you can also try to build the project, then manually refresh the layout.
This's the exception I got:
android.content.res.Resources$NotFoundException: Resource ID #0x7f090000
at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:237)
at android.content.res.Resources.getFraction(Resources.java:776)
at eo.view.signalstrength.SignalStrengthDrawable.<init>(SignalStrengthDrawable.kt:29)
at eo.view.signalstrength.SignalStrengthView.<init>(SignalStrengthView.kt:56)
at eo.view.signalstrength.SignalStrengthView.<init>(SignalStrengthView.kt:12)
at eo.view.signalstrength.SignalStrengthView.<init>(SignalStrengthView.kt)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:404)
at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:187)
at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:145)
at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadView(LayoutlibCallbackImpl.java:309)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:417)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:428)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:332)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:961)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:1123)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1097)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1084)
at android.view.LayoutInflater.inflate(LayoutInflater.java:682)
at android.view.LayoutInflater.inflate(LayoutInflater.java:501)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:328)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:396)
at com.android.tools.idea.layoutlib.LayoutLibrary.createSession(LayoutLibrary.java:209)
at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:608)
at com.android.tools.idea.rendering.RenderTask.lambda$inflate$6(RenderTask.java:734)
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
this's the xml code:
<eo.view.signalstrength.SignalStrengthView android:id="@+id/gcs_signal_level" android:layout_width="50dp" android:layout_height="50dp" app:layout_constraintEnd_toStartOf="@+id/gcs_battery_level" app:layout_constraintTop_toTopOf="parent" app:signalStrengthColor="?colorAccent" app:signalStrengthLevel="50" app:signalStrengthTheme="rounded" />
BTW I'm using battery-meter-view in the same project and it works fine. The sample application is working.
how did you solve it @weirdgyn
how did you solve it @weirdgyn
hi @Elswah .... I designed one on my own.
@weirdgyn could you share the custom view with me
I have some problem in copy pasting code here ... and the repository of the project where I'm using it is private. I'm sharing this .java files trough google drive:
https://drive.google.com/file/d/1017Kv8G9y_ysMIIVfsWQlhAYfRAUmIC-/view?usp=sharing