Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

AndroidActivity.SetPage occurs error when using 'NoActionBar' theme

$
0
0

I wrote following code for hiding ActionBar in startup.


[Activity(Label = "NoActionTestAndroid", 
    MainLauncher = true, 
    Theme = "@android:style/Theme.Holo.Light.NoActionBar")]
public class MainActivity : AndroidActivity
{
    protected override void OnCreate(Bundle bundle)
    {
        base.OnCreate(bundle);

        Xamarin.Forms.Forms.Init(this, bundle);

        SetPage(App.GetMainPage());
    }
}

Run this code, then occurs error in console and do not show main page in my
app.

Activity.ActionBar property will be null when using 'NoActionBar' theme.
I guess that Xamarin.Forms does not support No-ActionBar.

VERSIONS

Xamarin.Forms Nuget package version : 1.1.0.6201

ERRORS

[MonoDroid] UNHANDLED EXCEPTION: System.NullReferenceException: Object
reference not set to an instance of an object
[MonoDroid] at Xamarin.Forms.Platform.Android.Platform.UpdateActionBar ()
<0x0017c>
[MonoDroid] at Xamarin.Forms.Platform.Android.Platform.SetPage
(Xamarin.Forms.Page) <0x000b3>
[MonoDroid] at Xamarin.Forms.Platform.Android.AndroidActivity.SetPage
(Xamarin.Forms.Page) <0x0029f>
[MonoDroid] at SpacingTest.Android.MainActivity.OnCreate (Android.OS.Bundle)
<0x00037>
[MonoDroid] at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_
(intptr,intptr,intptr) <0x0005b>
[MonoDroid] at (wrapper dynamic-method)
object.4e4e55c8-22ec-4c23-85f3-7d45f23c15f3 (intptr,intptr,intptr) <0x00043>
[mono]
[mono] Unhandled Exception:
[mono] System.NullReferenceException: Object reference not set to an instance
of an object
[mono] at Xamarin.Forms.Platform.Android.Platform.UpdateActionBar ()
[0x00000] in :0
[mono] at Xamarin.Forms.Platform.Android.Platform.SetPage (Xamarin.Forms.Page
newRoot) [0x00000] in :0
[mono] at Xamarin.Forms.Platform.Android.AndroidActivity.SetPage
(Xamarin.Forms.Page page) [0x00000] in :0
[mono] at SpacingTest.Android.MainActivity.OnCreate (Android.OS.Bundle
bundle) [0x00000] in :0
[mono] at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (IntPtr jnienv,
IntPtr native__this, IntPtr native_savedInstanceState) [0x00000] in :0
[mono] at (wrapper dynamic-method)
object:4e4e55c8-22ec-4c23-85f3-7d45f23c15f3 (intptr,intptr,intptr)
[mono-rt] [ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException:
Object reference not set to an instance of an object
[mono-rt] at Xamarin.Forms.Platform.Android.Platform.UpdateActionBar ()
[0x00000] in :0
[mono-rt] at Xamarin.Forms.Platform.Android.Platform.SetPage
(Xamarin.Forms.Page newRoot) [0x00000] in :0
[mono-rt] at Xamarin.Forms.Platform.Android.AndroidActivity.SetPage
(Xamarin.Forms.Page page) [0x00000] in :0
[mono-rt] at SpacingTest.Android.MainActivity.OnCreate (Android.OS.Bundle
bundle) [0x00000] in :0
[mono-rt] at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (IntPtr
jnienv, IntPtr native__this, IntPtr native_savedInstanceState) [0x00000] in
:0
[mono-rt] at (wrapper dynamic-method)
object:4e4e55c8-22ec-4c23-85f3-7d45f23c15f3 (intptr,intptr,intptr)


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>