Forum Xamarin.Forms
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.

activity did not call through super.onresume exception

In my xamarin forms app, there is crash which is as follows from App Center crashlytics:

android.app.Activity.performResume:_

_Activity.java - line 7138
android.util.SuperNotCalledException: Activity
{com.tcrsoftware.androidx/md54f7a5b50cfc6839da41f22f8e0e378f9.MainActivity}
did not call through to super.onResume()
android.app.Activity.performResume Activity.java:7138
android.app.ActivityThread.performResumeActivity ActivityThread.java:3850
android.app.ActivityThread.handleResumeActivity ActivityThread.java:3914
android.app.ActivityThread$H.handleMessage ActivityThread.java:1709
android.os.Handler.dispatchMessage Handler.java:102
android.os.Looper.loop Looper.java:154
android.app.ActivityThread.main ActivityThread.java:6823
java.lang.reflect.Method.invoke Method.java
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
ZygoteInit.java:1557
com.android.internal.os.ZygoteInit.main ZygoteInit.java:1445

I just use onResume() in my Shared Library project like:

public partial class App : Application
{
protected override void OnResume()
{
Utility.LogMessage("OnResume: ", LogMessageType.info);
}
}

**I did not implement/use onResume() in the MainActivity class of android project.
**
Where and why this crash occured? And also would it be cause app to crash continously when user tries to open the app?

Posts

  • JoeMankeJoeManke USMember ✭✭✭✭✭

    Add base.OnResume(); to your override. super in Java means the same thing as base in C#.

  • sunkarisunkari Member ✭✭

    Thanks for the response @JoeManke .

    I use onResume() in only shared project's App.xaml.cs file (which extends Application). I did not use onResume() override method in MainActivity.cs file of Android project.

    Then why the above error says the crash is related to MainActivity class?

  • JoeMankeJoeManke USMember ✭✭✭✭✭

    I can't diagnose all of your Android problems based on 3 lines of cross-platform code. Post your MainActivity code. And if you have an Application class in your Android project (Android.App.Application) it might be helpful to post that too.

  • sunkarisunkari Member ✭✭

    Below are the MainActivity and Application class files of my android project

  • JoeMankeJoeManke USMember ✭✭✭✭✭

    Possibly an issue with ScreenOrientation = ScreenOrientation.Portrait in your Activity attribute? See https://stackoverflow.com/a/50208644

  • sunkarisunkari Member ✭✭
    edited November 2018

    Its difficult to say it's a fix as this error happens to few users randomly. Also, I want my app in Portrait mode all the time irrespective of the orientation.

Sign In or Register to comment.