Forum Xamarin.Android
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Idle Time out Error

UddhaoPachrneUddhaoPachrne INMember ✭✭
edited November 2015 in Xamarin.Android

My Application running fine, it resume fine when resume done within reasonable time but it not resume well if the timespan too much . Instead of displaying the activity content it just display an actionbar with title without any content of menuitems. It yield an “Object reference null” type of exception.

I know this is Activity life cycle problem but not getting luck.

This is my code :

public class MyFragmentActivity : AppCompatActivity, IMvxEventSourceActivity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
CreateCalled.Raise(this, bundle);
Mvx.Resolve();
}

    protected override void OnDestroy()
    {
        DestroyCalled.Raise(this);
        base.OnDestroy();
    }

    protected override void OnNewIntent(Intent intent)
    {
        base.OnNewIntent(intent);
        NewIntentCalled.Raise(this, intent);
    }

    protected override void OnResume()
    {
        base.OnResume();
        ResumeCalled.Raise(this);
    }

    protected override void OnPause()
    {
        PauseCalled.Raise(this);
        base.OnPause();
    }

    protected override void OnStart()
    {
        base.OnStart();
        StartCalled.Raise(this);
    }

    protected override void OnRestart()
    {
        base.OnRestart();
        RestartCalled.Raise(this);
    }

    protected override void OnStop()
    {
        StopCalled.Raise(this);
        base.OnStop();
    }

    public override void StartActivityForResult(Intent intent, int requestCode)
    {
        StartActivityForResultCalled.Raise(this, new MvxStartActivityForResultParameters(intent, requestCode));
        base.StartActivityForResult(intent, requestCode);
    }

    protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
    {
        ActivityResultCalled.Raise(this, new MvxActivityResultParameters(requestCode, resultCode, data));
        base.OnActivityResult(requestCode, resultCode, data);
    }

    protected override void OnSaveInstanceState(Bundle outState)
    {
        SaveInstanceStateCalled.Raise(this, outState);
        base.OnSaveInstanceState(outState);
    }

    protected override void Dispose(bool disposing)
    {
        if (disposing)
        {
            DisposeCalled.Raise(this);
        }
        base.Dispose(disposing);
    }

    public event EventHandler DisposeCalled;
    public event EventHandler<MvxValueEventArgs<Bundle>> CreateWillBeCalled;
    public event EventHandler<MvxValueEventArgs<Bundle>> CreateCalled;
    public event EventHandler DestroyCalled;
    public event EventHandler<MvxValueEventArgs<Intent>> NewIntentCalled;
    public event EventHandler ResumeCalled;
    public event EventHandler PauseCalled;
    public event EventHandler StartCalled;
    public event EventHandler RestartCalled;
    public event EventHandler StopCalled;
    public event EventHandler<MvxValueEventArgs<Bundle>> SaveInstanceStateCalled;
    public event EventHandler<MvxValueEventArgs<MvxStartActivityForResultParameters>> StartActivityForResultCalled;
    public event EventHandler<MvxValueEventArgs<MvxActivityResultParameters>> ActivityResultCalled;

} 

Please help me resolve this.

Thank You

Answers

Sign In or Register to comment.