Xamarin Android Ffimageloading Imageservice.instance.loadurl() System.nullreferenceexception
I've got a strange problem with FFImageLoading. Compiler don't show any error, but while application is starting on device, there is thrown an exception: System.NullReferenceExcept
Solution 1:
Okay, I found out what's wrong. XML below is not directly under ViewModel.
<FFImageLoading.Views.ImageViewAsync
android:id="@+id/imgDisplay"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="fitCenter" />
XML over there is called inside
<android.support.design.widget.NavigationView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@android:color/white"
android:id="@+id/nav_view"
app:headerLayout="@layout/drawer_header" <!-- here -->
app:menu="@menu/navmenu" />
</android.support.v4.widget.DrawerLayout>
So in this case I have to call properly view:
ViewheaderLayout= navigationView.InflateHeaderView(Resource.Layout.drawer_header);
and so on use FindViewById
like that:
imgThunbailUsername = headerLayout.FindViewById<ImageViewAsync>(Resource.Id.imgDisplay);
So all I need to do is just get a View headerlayout
with InflateHeaderView
.
Post a Comment for "Xamarin Android Ffimageloading Imageservice.instance.loadurl() System.nullreferenceexception"