MainActivity.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #region Copyright notice and license
  2. // Copyright 2020 The gRPC Authors
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License");
  5. // you may not use this file except in compliance with the License.
  6. // You may obtain a copy of the License at
  7. //
  8. // http://www.apache.org/licenses/LICENSE-2.0
  9. //
  10. // Unless required by applicable law or agreed to in writing, software
  11. // distributed under the License is distributed on an "AS IS" BASIS,
  12. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. // See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. #endregion
  16. using System;
  17. using Android.App;
  18. using Android.Content.PM;
  19. using Android.Runtime;
  20. using Android.Views;
  21. using Android.Widget;
  22. using Android.OS;
  23. namespace HelloworldXamarin.Droid
  24. {
  25. [Activity(Label = "HelloworldXamarin", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize )]
  26. public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
  27. {
  28. protected override void OnCreate(Bundle savedInstanceState)
  29. {
  30. TabLayoutResource = Resource.Layout.Tabbar;
  31. ToolbarResource = Resource.Layout.Toolbar;
  32. base.OnCreate(savedInstanceState);
  33. Xamarin.Essentials.Platform.Init(this, savedInstanceState);
  34. global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
  35. LoadApplication(new App());
  36. }
  37. public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults)
  38. {
  39. Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);
  40. base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
  41. }
  42. }
  43. }