[mono-android] mono-andriod-9794

Jonathan Pryor jpryor at novell.com
Tue Mar 15 07:33:03 EDT 2011


Please file a bug an provide source which reproduced the problem.

 - Jon

On Mar 15, 2011, at 6:00 AM, "El-Sayed Mohamed" <smohamed at victoryfn.com> wrote:

> Dear Jonathan,
> Me too had the same issue and after following your suggestation I have got
> the following exception when trying to run the app:
> 
> Exception of type 'Java.Lang.NullPointerException' was thrown.
> At Android.Runtime.JNIEnv.CallVoidMethod(IntPtr jobject, IntPtr jmethod,
> Android.Runtime.JValue[] params)[0x00023] in
> /home/jpobst/Desktop/mondroid/Mono. Android/src/Runtime/JNIEnv.cs:524
> At Android.Widget.TabHost.Add(Android.Widget.TabSpec tabSpec)[0x0003e] in
> /home/jpobst/Desktop/mondroid/Mono.
> Android/platforms/android-8/src/generated/ Android.Widget.TabHost.cs:790
> 
> Thank you in advance.
> 
> ----------------------------------------------------------------------------
> ----------------------------------------------------------
> Message: 3
> Date: Mon, 14 Mar 2011 22:22:25 -0400
> From: Jonathan Pryor <jpryor at novell.com>
> Subject: Re: [mono-android] mono-android-9794
> To: monodroid at lists.ximian.com
> Message-ID: <29AFDA7D-54BD-4FE0-BA34-F28B74643D21 at novell.com>
> Content-Type: text/plain; charset=us-ascii
> 
> On Mar 14, 2011, at 3:00 AM, Asmaa Mohamed Roushdy wrote:
>> After installing new version mono-android-9794 I had error in my code
> ...
> 
> I assume that you were getting compiler errors, not runtime errors (as those
> look like compiler errors...). On that assumption...
> 
>> 
>> // Initialize a TabSpec for each tab and add it to the TabHost spec = 
>> TabHost.NewTabSpec("MyListView");
> 
> TabHost.NewTabSpec(string) is an instance method:
> 
>    
> http://docs.monodroid.net/index.aspx?link=M%3aAndroid.Widget.TabHost.NewTabS
> pec(System.String)
> 
> You appear to be attempting to call it as a static method, hence the
> compiler error. You would instead need to do:
> 
>    TabHost host = new TabHost(this); // assuming inside Activity...
>    TabHost.TabSpec spec = host.NewTabSpec ("MyListView");
> 
>> spec.SetIndicator("ListView", 
>> Resources.GetDrawable(Resource.Drawable.ic_tab));
>> spec.SetContent(intent);
>> TabHost.AddTab(spec);
> 
> Similarly, TabHost.AddTab(TabHost.TabSpec) is an instance method, not a
> static method:
> 
>    
> http://docs.monodroid.net/index.aspx?link=M%3aAndroid.Widget.TabHost.AddTab(
> Android.Widget.TabHost.TabSpec)
> 
> As such, you need to call it on an instance:
> 
>    host.AddTab(spec);
> 
> - Jon
> 
> 
> 
> ------------------------------
> 
> _______________________________________________
> Monodroid mailing list
> Monodroid at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monodroid
> 
> 
> End of Monodroid Digest, Vol 8, Issue 60
> ****************************************
> 
> _______________________________________________
> Monodroid mailing list
> Monodroid at lists.ximian.com
> 
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid


More information about the Monodroid mailing list