[mono-android] NullException error

Gabe Codina Gabe at Agtrix.com
Sun Nov 20 18:11:17 EST 2011


What more information could you ask for, it has given you the line and the exception, obviously tab is null.  Nowhere in the code you supplied have you initialized tab  ie you need a line like so:

 

Var tab = new TabOne();

 

From: monodroid-bounces at lists.ximian.com [mailto:monodroid-bounces at lists.ximian.com] On Behalf Of Tomasz Cielecki
Sent: Monday, 21 November 2011 5:20 AM
To: Discussions related to Mono for Android; paul at all-the-johnsons.co.uk
Subject: Re: [mono-android] NullException error

 

tab is probably null then. 

On Nov 20, 2011 2:32 AM, "Paul F. Johnson" <paul at all-the-johnsons.co.uk> wrote:

Hi,

My (slowly) developing Android app seems to have come a cropper with a
very unhelpful error message

Unhandled Exception:

System.NullReferenceException:

and that's it.

I have three tabs. Tab 2 has a reference to tab 1 like this

public class tabTwo : Activity
{
 tabOne tab;
 // etc
}

The button handler looks like this

private void(object s, EventArgs e)
{
 if (tab.var1 == 0 || tab.var2 == 0 || tab.var3 == 0)
 {
   // toast line - you can't have any of these to be zero
   return;
  }
}

The exception is at the tab.var1 line.

Should the throwback be giving more information than that?

Paul
--
Vertraue mir, ich weiss, was ich mache...

_______________________________________________
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/pipermail/monodroid/attachments/20111121/c323ea9d/attachment.html 


More information about the Monodroid mailing list