App crashed in android oreo 8.1

kefikefi Member ✭✭

I am using xamarin prism and we simply navigate to the other page on clicking list item.But when we click on the entry field then app is crashed and these problem occur only in android oreo.

**My Error is:
**
04-16 11:45:47.844 D/[email protected]MainActivity: ViewPostIme pointer 0
04-16 11:45:47.945 D/[email protected]MainActivity: ViewPostIme pointer 1
04-16 11:45:47.948 D/AbsListView(15775): onTouchUp() mTouchMode : 0
04-16 11:45:48.118 W/zygote64(15775): JNI RegisterNativeMethods: attempt to register 0 native methods for md51558244f76c53b6aeda52c8a337f2c37.EntryRenderer
04-16 11:45:49.424 D/[email protected]MainActivity: ViewPostIme pointer 0
04-16 11:45:49.499 D/[email protected]MainActivity: ViewPostIme pointer 1
04-16 11:45:49.567 V/InputMethodManager(15775): Starting input: [email protected] nm : com.kefi [email protected]
04-16 11:45:49.567 D/InputMethodManager(15775): startInputInner - Id : 0
04-16 11:45:49.568 I/InputMethodManager(15775): startInputInner - mService.startInputOrWindowGainedFocus
04-16 11:45:49.570 D/InputTransport(15775): Input channel constructed: fd=100
04-16 11:45:49.571 D/InputTransport(15775): Input channel destroyed: fd=96
04-16 11:45:49.571 D/InputMethodManager(15775): SSI - flag : 0 Pid : 15775 view : com.kefi
04-16 11:45:49.621 D/InputTransport(15775): Input channel constructed: fd=99
04-16 11:45:49.622 D/[email protected]PopupWindow:5ff656a: setView = android.widget.PopupWindow$PopupDecorView{c266e36 V.E...... ......I. 0,0-0,0} TM=true MM=false
04-16 11:45:49.640 D/[email protected]PopupWindow:5ff656a: dispatchAttachedToWindow
04-16 11:45:49.664 V/Surface (15775): sf_framedrop debug : 0x4f4c, game : false, logging : 0
04-16 11:45:49.664 D/[email protected]PopupWindow:5ff656a: Relayout returned: old=[0,0][0,0] new=[356,756][436,851] result=0x7 surface={valid=true 528188313600} changed=true
04-16 11:45:49.668 D/mali_winsys(15775): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000, [80x95]-format:1
04-16 11:45:49.668 D/OpenGLRenderer(15775): eglCreateWindowSurface = 0x7b09dee680, 0x7afa7a1010
04-16 11:45:49.685 D/[email protected]PopupWindow:5ff656a: MSG_RESIZED_REPORT: frame=Rect(356, 756 - 436, 851) ci=Rect(0, 0 - 0, 0) vi=Rect(0, 0 - 0, 0) or=1
04-16 11:45:50.027 D/[email protected]MainActivity: MSG_RESIZED: frame=Rect(0, 0 - 1080, 2340) ci=Rect(0, 85 - 0, 126) vi=Rect(0, 85 - 0, 939) or=1
Unhandled Exception:

System.NullReferenceException: Object reference not set to an instance of an object.

**And My viewModel class is **

using Acr.UserDialogs;
using Kefi.Helper;
using Kefi.Interfaces;
using Kefi.Models.API.RequestModel;
using Plugin.Connectivity;
using Prism.Commands;
using Prism.Mvvm;
using Prism.Navigation;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Xamarin.Forms;

namespace Kefi.ViewModels
{
public class LANIPScreenViewModel : BindableBase
{
private INavigationService _navigationService;
private string _labelLANIP ;
private string _labelSubnetMask;
private IWebApiCallService _webApiCallService;
private string _netmask;
public string LabelLANIP
{
get {
_labelLANIP = LocalSettings.Lan_ip.ToString();
return _labelLANIP;

        }
        set { _labelLANIP  = value; }
    }
    public string Netmask
    {
        get {
            _netmask = LocalSettings.Netmask.ToString();
            return _netmask;
        }
        set { _netmask = value; }
    }

    public LANIPScreenViewModel(INavigationService navigationService, IWebApiCallService webApiCallService)
    {
        _navigationService = navigationService;
        _webApiCallService = webApiCallService;

        //Lanipaddress();
    }
    //private async Task Lanipaddress()
    //{


    //}
    public DelegateCommand BackButtonCommand => new DelegateCommand(() =>
    {
        Device.BeginInvokeOnMainThread(async () =>
        {
            await _navigationService.NavigateAsync("AdvancedScreen");
        });
    });
    public DelegateCommand SaveCommand => new DelegateCommand(() =>
    {
        Device.BeginInvokeOnMainThread(async () =>
        {
            try
            {
                if (CrossConnectivity.Current.IsConnected)
                {
                    var isValid = Regex.IsMatch(_labelLANIP, @"^([1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3}$");
                    if (isValid)
                    {
                        var isValid2 = Regex.IsMatch(_netmask, @"^(255|254|252|248|240|224|192|128|0+)\.(255|254|252|248|240|224|192|128|0+)\.(255|254|252|248|240|224|192|128|0+)\.(255|254|252|248|240|224|192|128|0+)$");
                        if (isValid2)
                        {
                            LanIpRequestModel lanIpdata = new LanIpRequestModel
                            {
                                kefi_device_id = App.Current.Properties["DeviceId"].ToString(),
                                lan_ip = _labelLANIP,
                                subnet = _netmask
                            };
                            UserDialogs.Instance.ShowLoading();
                            var result = await _webApiCallService.LANIP(lanIpdata);
                            if (result.statusCode == 200)
                            {
                                LocalSettings.Lan_ip = _labelLANIP;
                                UserDialogs.Instance.HideLoading();
                                DependencyService.Get<Toasts>().Show("Data changed successfully.");
                            }
                            else if (result.statusCode == 404)
                            {
                                UserDialogs.Instance.HideLoading();
                                DependencyService.Get<Toasts>().Show("Couldn't complete request at this moment. Your device seems to be offline.");
                            }
                            else
                            {
                                UserDialogs.Instance.HideLoading();
                                //DependencyService.Get<Toasts>().Show("Something went wrong!.Please try again");
                            }
                        }
                        else
                        {
                            DependencyService.Get<Toasts>().Show("Subnet mask is not in correct format");
                        }
                    }
                    else
                    {
                        DependencyService.Get<Toasts>().Show("Lan ip is not in correct format");
                    }
                }
                else
                {
                    UserDialogs.Instance.HideLoading();
                    DependencyService.Get<Toasts>().Show("Couldn't connect to internet.Please try again");
                }
            }
            catch
            {
                UserDialogs.Instance.HideLoading();
                //DependencyService.Get<Toasts>().Show("Internal Server Error.Please try again");
            }
        });
    });
}

}

And page.xaml.cs is :

using Xamarin.Forms;
using Xamarin.Forms.Xaml;

namespace Kefi.Views.Advanced
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class LANIPScreen : ContentPage
{
public LANIPScreen()
{
InitializeComponent();
}
protected override bool OnBackButtonPressed()
{
Device.BeginInvokeOnMainThread(async () =>
{
await Navigation.PushModalAsync(new AdvancedScreen(), true);
});
return true;
}
}
}

**And xaml is: **

Answers

  • jezhjezh Member, Xamarin Team Xamurai

    Could you please post a basic demo so that we can test with it?

  • kefikefi Member ✭✭

    so how we post the demo in form of video or any other please tell?

  • jezhjezh Member, Xamarin Team Xamurai

    If it's convenient , would you mind sharing your demo as an attachment or sharing a link from which we can download the code?

  • kefikefi Member ✭✭

    are you using team viewer?

  • jezhjezh Member, Xamarin Team Xamurai

    I'm not using this tool right now. You can commit your code to github and share the link with us.

Sign In or Register to comment.