[mono-android] Calling OnStart causes ForceClose
Roger Heim
roger.heim at gmail.com
Mon Mar 28 22:17:36 EDT 2011
You run "adb logcat" from the Windows command line (adb is Android Debug
Bridge.) The logcat parameter will show you the device/emulator's error log.
Also, if you override onStart() it has to call the base.OnStart(). You
should review
http://developer.android.com/intl/fr/reference/android/app/Activity.html to
understand the Activity lifecycle. Even though you're not programming in
Java this stuff still matters.
Roger
On Mon, Mar 28, 2011 at 10:01 PM, <www at gencode.com> wrote:
> 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
>
> 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, <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
>
> Monodroid at lists.ximian.com
>
>
>
> UNSUBSCRIBE INFORMATION:
>
> http://lists.ximian.com/mailman/listinfo/monodroid
>
> _______________________________________________
> Monodroid mailing list
> Monodroid at lists.ximian.com
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/mailman/private/monodroid/attachments/20110328/e8800358/attachment-0001.html
More information about the Monodroid
mailing list