hi
i use this code but mpt in mainactivity and i got erorr in recycleradapter in itemcount that Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object. occurred
`
public override Java.Lang.Object InstantiateItem(ViewGroup container, int position)
{
View view = LayoutInflater.From(container.Context).Inflate(Resource.Layout.pager_item, container, false);
container.AddView(view);
mRecyclerView = view.FindViewById<RecyclerView>(Resource.Id.recycler);
mLayoutManager = new LinearLayoutManager(view.Context);
mRecyclerView.SetLayoutManager(mLayoutManager);
mclient = new WebClient();
Url = new Uri("http://www.aashuraian.ir/api/akhbarmashruhs");
mclient.DownloadDataCompleted += MclientOnDownloadDataCompleted;
mclient.DownloadDataAsync(Url);
mAdapter = new RecyclerAdapter(_akhbarMashruhs);
mRecyclerView.SetAdapter(mAdapter);
return view;
}
public void MclientOnDownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e)
{
var json = Encoding.UTF8.GetString(e.Result);
_akhbarMashruhs = JsonConvert.DeserializeObject<List<AkhbarMashruh>>(json);
}`