[mono-android] Calling OnStart causes ForceClose

Ed Scott support at gencode.com
Mon Mar 28 22:09:25 EDT 2011


RESOLVED

 

I added the            base.OnStart();

And the error went away

 

Ed,

___________________________________________________________

Ed Scott | Microsoft Certified Solutions Developer (MCSD)

www: http://www.gencode.com <http://www.gencode.com/>  

emaill: escott at gencode.com
Location:  Earth, Milkyway Galaxy

 

From: monodroid-bounces at lists.ximian.com
[mailto:monodroid-bounces at lists.ximian.com] On Behalf Of www at gencode.com
Sent: Monday, March 28, 2011 10:02 PM
To: monodroid at lists.ximian.com
Subject: Re: [mono-android] Calling OnStart causes ForceClose

 

Jon,

 

I am not sure how to get the "`adb logcat` output "

 

Is this it?

 

virtual void WebCore::Widget::show()

virtual void WebCore::Widget::show()

static bool WebCore::ResourceHandle::supportsBufferedData()

virtual void WebCore::Widget::show()

static bool WebCore::ResourceHandle::supportsBufferedData()

static bool WebCore::ResourceHandle::supportsBufferedData()

 

 

The error is

The application (app name) has stopped unexpectedly, please try again.

 

Here's the code, note if I comment out the OnStart the error goes away.

 

   [Activity(Label = "My Activity")]

    public class WarningsActivity : Activity

    {

        protected override void OnStart()

        {

        }

 

        protected override void OnCreate(Bundle bundle)

        {

            base.OnCreate(bundle);

        }

    }

 

 

 

___________________________________________________________

Ed Scott | Microsoft Certified Solutions Developer (MCSD)

www: http://www.gencode.com <http://www.gencode.com/>  

emaill: escott at gencode.com
Location:  Earth, Milkyway Galaxy

-----Original Message-----
From: monodroid-bounces at lists.ximian.com
[mailto:monodroid-bounces at lists.ximian.com] On Behalf Of Jonathan Pryor
Sent: Sunday, March 27, 2011 10:21 AM
To: monodroid at lists.ximian.com
Subject: Re: [mono-android] Calling OnStart causes ForceClose

 

On Mar 27, 2011, at 9:28 AM, < <mailto:www at gencode.com> www at gencode.com> <
<mailto:www at gencode.com> www at gencode.com> wrote:

> If I put this in my activity

>         protected override void OnStart()

>  

> I get a force close.

 

Please provide the `adb logcat` output.

 

Now, by "force close" do you mean the "Application Not Responding" dialog,
which asks you whether you want to Wait or Force Close?

 

> I put a call to a webservice in the

>         protected override void OnCreate(Bundle bundle)

>  

> but it crashes so I think I need to wait further in the lifecycle, I
assume the best place for this is on the OnStart?

 

Again, please provide the `adb logcat` output.

 

I suspect that the problem is that you're doing the webservice call on the
main thread. If e.g. OnCreate() or OnStart() take too long to execute (iirc
~5s), then the Application Not Responding dialog is shown. Te only way to
avoid this is to spawn another thread to do the webservice call (allowing
the main thread to return), and have the new thread perform the webservice
call then use Activity.RunOnUiThread() to update the UI.

 

- Jon

 

_______________________________________________

Monodroid mailing list

 <mailto:Monodroid at lists.ximian.com> Monodroid at lists.ximian.com

 

UNSUBSCRIBE INFORMATION:

 <http://lists.ximian.com/mailman/listinfo/monodroid>
http://lists.ximian.com/mailman/listinfo/monodroid

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/mailman/private/monodroid/attachments/20110328/3fdaca8e/attachment-0001.html 


More information about the Monodroid mailing list