Closed chigup closed 5 years ago
What does your logcat says? Can you share your adapter?
E/AndroidRuntime: FATAL EXCEPTION: main Process: com.teepe.teepe, PID: 9014 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.teepe.teepe/com.teepe.teepe.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void io.supercharge.shimmerlayout.ShimmerLayout.startShimmerAnimation()' on a null object reference at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2646) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707) at android.app.ActivityThread.-wrap12(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6077) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void io.supercharge.shimmerlayout.ShimmerLayout.startShimmerAnimation()' on a null object reference at com.teepe.teepe.MainActivity.onCreate(MainActivity.java:97) at android.app.Activity.performCreate(Activity.java:6662)
@chigup It seems very very strange that you got an NPE on the layout at an adapter.
Could you create a sample app where you can reproduce the crash? It would be a great help.
Seems like you haven't initialized the ShimmerLayout
.
Maybe you are calling startShimmerAnimation()
before findViewById(R.id.shimmer_Main_card)
or you are not initializing it appropiately in your ViewHolder
Thanks @GuanacoDevs this was the problem
Here is my layout
` <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="8dp" android:layout_marginTop="8dp" android:layout_marginEnd="8dp" android:layout_marginBottom="8dp" android:orientation="vertical" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_bias="0.026">
Thanks in advance`