0
複数のAndroidアクティビティを使用したいと思います。最初は一般的なアプリケーションです。 2番目は通知ビューです。彼らはさまざまな活動設定を持っているので、私はこの問題に対して1つの活動を使用することはできません。複数のXamarin.Forms Androidアクティビティ
は、私はこれを行うにしてみてください。この行で
[Activity(Label = "Life Manager", MainLauncher = true, Icon = "@drawable/icon")]
public class MainActivity : FormsApplicationActivity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
Forms.Init(this, bundle);
ActionBar.SetIcon(new ColorDrawable(Color.Transparent));
LoadApplication(new TimeManagerApplication());
Device.StartTimer(new TimeSpan(0, 0, 0, 5), OpenNotificationActivity);
}
private bool OpenNotificationActivity()
{
Intent intent = new Intent(this, typeof(NotificationActivity));
StartActivity(intent);
return false;
}
}
[Activity(Label = "NotificationActivity")]
public class NotificationActivity : FormsApplicationActivity
{
protected override void OnCreate(Bundle savedInstanceState)
{
RequestWindowFeature(WindowFeatures.NoTitle);
Window.AddFlags(WindowManagerFlags.Fullscreen | WindowManagerFlags.KeepScreenOn);
base.OnCreate(savedInstanceState);
Forms.Init(this, savedInstanceState);
LoadApplication(new NotificiationApplication());
}
}
:私は1つのアプリケーションで2つのアンドロイドのアクティビティを使用するにはどうすればよい
System.NullReferenceException: Object reference not set to an instance of an object.
:
LoadApplication(new NotificiationApplication());
私はエラーを取りますクロスプラットフォームのXamarin.Formsビューを使用しますか?
更新:これらの行のアプリケーションがなければ
は完璧に動作します:
//RequestWindowFeature(WindowFeatures.NoTitle);
//Window.AddFlags(WindowManagerFlags.Fullscreen | WindowManagerFlags.KeepScreenOn);
しかし、どのように私は、ステータスバーを非表示とフルスクリーンビューを使用できますか?
なぜ同じアクティビティを使用しないのですか?通知を受信すると、正しいビューに移動するだけです。 – Eastrall
@エストリル、活動のさまざまな設定に注意してください。通知ビューでステータスバーを表示しないで、フルスクリーンと状態が必要です。 – uda