Issue
In Xamarin, I am coding a ViewPager application and am getting this error:
Cannot cast from source type to destination type.
At this line of code:
ViewPager pager = (ViewPager) FindViewById(Resource.Id.viewPager);
Here is my activity_main.axml layout file with the reference to the ViewPager:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/viewPager"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
May I have some help with this please?
Thanks in advance
Solution
It's incorrect for monodroid, use this one instead:
ViewPager pager = FindViewById<ViewPager>(Resource.Id.viewPager);
Answered By - choper
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.