public override void OnCreate() { StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); base.OnCreate(); CrossCurrentActivity.Current.Init(this); }
protected override void OnCreate(Bundle savedInstanceState) { Instance = this; StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); LoadApplication(new KTApp()); var ci = DependencyService.Get <Localize>().GetCurrentCultureInfo(); AndroidPlaystoreAudit.Instance.UsesUntilPrompt = 1; AndroidPlaystoreAudit.Instance.TimeUntilPrompt = new TimeSpan(2, 0, 0, 0); if (ci.TwoLetterISOLanguageName == "fr") { AndroidPlaystoreAudit.Instance.DontRemindButtonText = "Ne plus afficher"; AndroidPlaystoreAudit.Instance.RemindLaterButtonText = "Me rappeler plus tard"; AndroidPlaystoreAudit.Instance.ReviewAppStoreButtonText = "Noter l'application"; AndroidPlaystoreAudit.Instance.PromptTitle = "Pourriez-vous prendre une minute pour noter cette application?"; } AndroidPlaystoreAudit.Instance.Run(this); GameHelper.Helper = new GameHelper(this); GameHelper.Helper.GravityForPopups = (GravityFlags.Bottom | GravityFlags.Center); GameHelper.Helper.ViewForPopups = FindViewById <Android.Views.View>(Resource.Id.container); GameHelper.Helper.Initialize(); }
protected override void OnCreate(Bundle bundle) { // If these are not used the ToString for DateTime throws an exception in some cultures // For more information: https://forums.xamarin.com/discussion/42899/datetime-tostring-throws-argumentoutofrangeexception-in-thai-locale var c1 = new System.Globalization.ChineseLunisolarCalendar(); var c2 = new System.Globalization.GregorianCalendar(); var c3 = new System.Globalization.HebrewCalendar(); var c4 = new System.Globalization.HijriCalendar(); var c5 = new System.Globalization.JapaneseCalendar(); var c6 = new System.Globalization.JapaneseLunisolarCalendar(); var c7 = new System.Globalization.JulianCalendar(); var c8 = new System.Globalization.KoreanCalendar(); var c9 = new System.Globalization.KoreanLunisolarCalendar(); var c10 = new System.Globalization.PersianCalendar(); var c11 = new System.Globalization.TaiwanCalendar(); var c12 = new System.Globalization.TaiwanLunisolarCalendar(); var c13 = new System.Globalization.ThaiBuddhistCalendar(); var c14 = new System.Globalization.UmAlQuraCalendar(); StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); base.OnCreate(bundle); CrossCurrentActivity.Current.Init(this, bundle); PermissionsHelper.Activity = this; this.SetTheme(Resource.Style.Theme_Design_Light); //CachedImageRenderer.Init(false); FFImageLoading.Forms.Platform.CachedImageRenderer.Init(false); global::Xamarin.Forms.Forms.Init(this, bundle); LoadApplication(new App()); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); var builder = new StrictMode.VmPolicy.Builder(); var policy = builder.DetectActivityLeaks().PenaltyLog().Build(); StrictMode.SetVmPolicy(policy); SetContentView(Resource.Layout.Main); SearchView = FindViewById <Android.Widget.SearchView>(Resource.Id.SearchView); StateIndicator = FindViewById <TextView>(Resource.Id.StateIndicator); TryNewScreen = FindViewById <Button>(Resource.Id.OpenNewActivity); TryNewScreen.Click += GoToSecondScreen; retainedFragment = FragmentManager.FindFragmentByTag("SearchPresenter") as SearchFragment; if (retainedFragment == null) { retainedFragment = new SearchFragment(); FragmentManager.BeginTransaction().Add(retainedFragment, "SearchPresenter").Commit(); retainedFragment.Presenter = new SearchPresenter(new SearchUseCase(new MySearchApi())); } retainedFragment.Presenter.AttachView(this); retainedFragment.Presenter.BindIntents(); }
protected override void OnCreate(Bundle bundle) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(bundle); StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); /*if (ActivityCompat.ShouldShowRequestPermissionRationale(this, Manifest.Permission.AccessFineLocation)) * { * // Provide an additional rationale to the user if the permission was not granted * // and the user would benefit from additional context for the use of the permission. * // For example if the user has previously denied the permission. * //Log.Info(TAG, "Displaying camera permission rationale to provide additional context."); * * var requiredPermissions = new String[] { Manifest.Permission.AccessFineLocation }; * Snackbar.Make(, * Resource.String.permission_location_rationale, * Snackbar.LengthIndefinite) * .SetAction(Resource.String.ok, * new Action<View>(delegate (View obj) { * ActivityCompat.RequestPermissions(this, requiredPermissions, REQUEST_LOCATION); * } * ) * ).Show(); * } * else * { * ActivityCompat.RequestPermissions(this, new String[] { Manifest.Permission.Camera }, REQUEST_LOCATION); * }*/ global::Xamarin.Forms.Forms.Init(this, bundle); DependencyService.Register <IVersionHelper, VersionHelper>(); LoadApplication(new App()); }
public void GetImageFromCamera() { if (!PermissionHelper.CheckPermissions(Fragment.Activity, new List <string> { Manifest.Permission.WriteExternalStorage, Manifest.Permission.Camera })) { (Fragment.ViewModel as IChallengeShareViewModel).ShowToastIfPermissionsDenided(); return; } NeedCrop = false; StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); var intent = new Intent(MediaStore.ActionImageCapture); imageUri = Android.Net.Uri.FromFile(new Java.IO.File(pathToNewPhoto)); intent.PutExtra(MediaStore.ExtraOutput, imageUri); intent.PutExtra("android.intent.extras.CAMERA_FACING", (int)Android.Hardware.Camera.CameraInfo.CameraFacingBack); intent.PutExtra("android.intent.extras.LENS_FACING_FRONT", 0); if (UseFrontCamera) { intent.PutExtra("android.intent.extra.USE_FRONT_CAMERA", false); } if (!UseFrontCamera) { intent.PutExtra("android.intent.extra.USE_FRONT_CAMERA", false); } intent.AddFlags(ActivityFlags.GrantReadUriPermission); UserImageWasAdded = true; Fragment.StartActivityForResult(intent, AndroidRequestCode.CameraRequestCode); }
protected override void OnCreate(Bundle savedInstanceState) { StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); StrictMode.ThreadPolicy.Builder builder1 = new StrictMode.ThreadPolicy.Builder().PermitAll(); StrictMode.SetThreadPolicy(builder1.Build()); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Login); ic = new InternetConnection(); prefs = PreferenceManager.GetDefaultSharedPreferences(ApplicationContext); restService = new ServiceHelper(); geo = new Geolocation(); user = FindViewById <EditText>(Resource.Id.username); pass = FindViewById <EditText>(Resource.Id.pass); log = FindViewById <Button>(Resource.Id.login); log.Click += delegate { UserLogin(); }; main_method(); }
protected override void OnCreate(Bundle bundle) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; FFImageLoading.Forms.Platform.CachedImageRenderer.Init(true); TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; App.DisplayScreenWidth = (double)Resources.DisplayMetrics.WidthPixels / (double)Resources.DisplayMetrics.Density; App.DisplayScreenHeight = (double)Resources.DisplayMetrics.HeightPixels / (double)Resources.DisplayMetrics.Density; App.DisplayScaleFactor = (double)Resources.DisplayMetrics.Density; StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); base.OnCreate(bundle); Plugin.CurrentActivity.CrossCurrentActivity.Current.Init(this, bundle); global::Xamarin.Forms.Forms.Init(this, bundle); var dbpath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); var storagepath = global::Android.OS.Environment.ExternalStorageDirectory.AbsolutePath; LoadApplication(new App(dbpath, storagepath)); }
public override void OnCreate() { base.OnCreate(); var builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); MyFirebaseMessagingService.Initialize(this); if (IsPlayServicesAvailable()) { FirebaseMessaging.Instance.SubscribeToTopic("Default"); } CreateNotificationChannel(); var prefs = GetSharedPreferences("FCM_TOKEN", FileCreationMode.Private); var token = prefs.GetString("FCM_TOKEN", string.Empty); if (!string.IsNullOrWhiteSpace(token)) { Console.WriteLine($"FCM TOKEN: {token}"); //CrossPushNotification.Current.SetToken(token); } FirebaseApp.InitializeApp(this); //CrossCurrentActivity.Current.Init(this); }
protected override void OnCreate(Bundle savedInstanceState) { StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.cadastrar_venda); CarregarElementos(); CarregarClientes(); if (!String.IsNullOrEmpty(Intent.GetStringExtra("FluxoEdicaoVenda"))) { IdVenda = int.Parse(Intent.GetStringExtra("FluxoEdicaoVenda")); var dtVenda = UtilDataBase.GetItems(VendaDB.TableName, string.Format(" Id = {0}", IdVenda), null); ExibirVenda(new VendaDB(dtVenda.Rows[0])); } if (IsThereAnAppToTakePictures()) { CreateDirectoryForPictures(); _imageView.Click += ImageViewFoto_Click; } }
public override void OnCreate() { StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); base.OnCreate(); SetupLeakCanary(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); SetContentView(Resource.Layout.TakePictureView); FindViews(); HandleEvents(); //utworzenie podfolderu o nazwie JakNaPiwo imageDirectory = new File(Android.OS.Environment.GetExternalStoragePublicDirectory( Android.OS.Environment.DirectoryPictures), "JakNaPiwo"); if (!imageDirectory.Exists()) { imageDirectory.Mkdirs(); } //getIntent().getSerializableExtra("Myitem"); //receiveImagePath = Intent.GetStringExtra("imagePath"); editBeerId = Intent.Extras.GetInt("editBeerId"); // Toast.MakeText(this, "coś " + receiveImagePath, ToastLength.Short).Show(); }
protected override void OnCreate(Bundle savedInstanceState) { //Inicializacion de variables base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Datos); lista = FindViewById <Android.Widget.ListView>(Resource.Id.lista); nombres = new List <string>(); ruta = Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/CameraScanner"; directorio = new File(ruta); archivos = directorio.ListFiles(); //Boton volver Android.Widget.Button volver = FindViewById <Android.Widget.Button>(Resource.Id.btn_volver); //Evento del boton volver volver.Click += Volver; //Boton flotante para borrado (No funcional/En pruebas) FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab); fab.Click += PreguntaBorradoCompleto; //Ignora la URI de los archivos StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); CrearListado(); //Eventos del ListView lista.ItemClick += AbrirArchivo; lista.ItemLongClick += PreguntaBorradoSimple; }
protected override void OnCreate(Bundle savedInstanceState) { StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_main); Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); mContext = this; FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab); fab.Click += FabOnClick; DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, Resource.String.navigation_drawer_open, Resource.String.navigation_drawer_close); drawer.AddDrawerListener(toggle); toggle.SyncState(); NavigationView navigationView = FindViewById <NavigationView>(Resource.Id.nav_view); navigationView.SetNavigationItemSelectedListener(this); if (IsThereAnAppToTakePictures()) { CreateDirectoryForPictures(); } System.Console.WriteLine("App loaded"); }
protected override void OnCreate(Bundle savedInstanceState) { TypedArray styledAttributes = this.Theme.ObtainStyledAttributes( new int[] { Android.Resource.Attribute.ActionBarSize }); var actionbarHeight = (int)styledAttributes.GetDimension(0, 0); App.ScreenWidth = (int)Resources.DisplayMetrics.WidthPixels; // real pixels App.ScreenHeight = (int)Resources.DisplayMetrics.HeightPixels + actionbarHeight; // real pixels TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; RequestWindowFeature(WindowFeatures.NoTitle); StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); base.OnCreate(savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); //==================================== int uiOptions = (int)Window.DecorView.SystemUiVisibility; uiOptions |= (int)SystemUiFlags.LowProfile; uiOptions |= (int)SystemUiFlags.Fullscreen; uiOptions |= (int)SystemUiFlags.HideNavigation; uiOptions |= (int)SystemUiFlags.ImmersiveSticky; Window.DecorView.SystemUiVisibility = (StatusBarVisibility)uiOptions; //==================================== LoadApplication(new App()); }
public override void OnCreate() { if (BuildConfig.DEBUG) { StrictMode.SetThreadPolicy(new StrictMode.ThreadPolicy.Builder() .DetectCustomSlowCalls() .DetectNetwork() .PenaltyLog() .PenaltyDeath() .Build()); StrictMode.SetVmPolicy(new StrictMode.VmPolicy.Builder() .DetectActivityLeaks() .DetectLeakedClosableObjects() .DetectLeakedRegistrationObjects() .DetectLeakedSqlLiteObjects() .PenaltyLog() .PenaltyDeath() .Build()); } base.OnCreate(); if (Settings.getVersion(this) != BuildConfig.VERSION_CODE) { Settings.setVersion(this); } mDefaultExceptionHandler = Thread.DefaultUncaughtExceptionHandler; Thread.DefaultUncaughtExceptionHandler = this; }
protected override void OnCreate(Bundle bundle) { AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; AndroidEnvironment.UnhandledExceptionRaiser += AndroidEnvironment_UnhandledExceptionRaiser; // bug with URI at android 7 :: https://stackoverflow.com/questions/44434150/android-application-crashes-while-launch-camera-activity-visual-studio-xamarin StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); base.Window.RequestFeature(WindowFeatures.ActionBar); base.SetTheme(Resource.Style.MainTheme); TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; FFImageLoading.Forms.Droid.CachedImageRenderer.Init(); base.OnCreate(bundle); Rg.Plugins.Popup.Popup.Init(this, bundle); global::Xamarin.Forms.Forms.Init(this, bundle); ServicePointManager.ServerCertificateValidationCallback += (o, certificate, chain, errors) => true; if (null == XComosMobile.Services.XServices.Instance.GetService <XComosMobile.Services.IPlatformSystem>()) { XComosMobile.Services.XServices.Instance.AddService <XComosMobile.Services.IPlatformSystem>(new PlatformSystem(this)); XComosMobile.Services.XServices.Instance.AddService <XComosMobile.Services.IDatabase>( (new Database()).Open("xcomos.db")); } ZXing.Mobile.MobileBarcodeScanner.Initialize(Application); CrossCurrentActivity.Current.Init(this, bundle); DependencyService.Register <IStatusBarStyleManager, StatusBarStyleManager>(); LoadApplication(new App()); // https://blog.xamarin.com/requesting-runtime-permissions-in-android-marshmallow/ if ((int)Build.VERSION.SdkInt >= 23) { string[] PermissionsAndroid = { Android.Manifest.Permission.CaptureAudioOutput, Android.Manifest.Permission.Vibrate, Android.Manifest.Permission.RecordAudio, Android.Manifest.Permission.WriteExternalStorage, Android.Manifest.Permission.AccessNetworkState, Android.Manifest.Permission.ModifyAudioSettings, Android.Manifest.Permission.MediaContentControl, Android.Manifest.Permission.Camera, }; for (int i = 0; i < PermissionsAndroid.Length; i++) { if (CheckSelfPermission(PermissionsAndroid[i]) == (int)Permission.Granted) { continue; } else { System.Diagnostics.Debug.WriteLine("No Permission to " + PermissionsAndroid[i]); RequestPermissions(PermissionsAndroid, i); } } } }
public override void OnCreate(Bundle savedInstanceState) { StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); StrictMode.ThreadPolicy.Builder builder1 = new StrictMode.ThreadPolicy.Builder().PermitAll(); StrictMode.SetThreadPolicy(builder1.Build()); base.OnCreate(savedInstanceState); }
public override void OnCreate(Bundle savedInstanceState) { StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); StrictMode.ThreadPolicy.Builder builder1 = new StrictMode.ThreadPolicy.Builder().PermitAll(); StrictMode.SetThreadPolicy(builder1.Build()); version = Android.App.Application.Context.ApplicationContext.PackageManager.GetPackageInfo(Android.App.Application.Context.ApplicationContext.PackageName, 0).VersionName; base.OnCreate(savedInstanceState); }
//public static List<SubmitModel> summarydata = new List<SubmitModel>(); public override void OnCreate(Bundle savedInstanceState) { StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); im_model = new RecyclerAdapter <TaskInboxModel>(); StrictMode.SetVmPolicy(builder.Build()); StrictMode.ThreadPolicy.Builder builder1 = new StrictMode.ThreadPolicy.Builder().PermitAll(); StrictMode.SetThreadPolicy(builder1.Build()); base.OnCreate(savedInstanceState); }
protected override void OnCreate(Bundle savedInstanceState) { StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.view_activity); fragment = CreateFragment(); SupportFragmentManager.BeginTransaction().Replace(Resource.Id.container_master, fragment).Commit(); }
public TakePicturePage() { InitializeComponent(); StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); MyImage = new Image(); image.Source = MyImage.Source; }
public void TakeAPicture(Activity context) { Intent intent = new Intent(MediaStore.ActionImageCapture); App._file = new Java.IO.File(App._dir, String.Format("myPhoto_{0}.jpg", Guid.NewGuid())); intent.PutExtra(MediaStore.ExtraOutput, Android.Net.Uri.FromFile(App._file)); StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); context.StartActivityForResult(intent, 0); }
private void AddFormCamera() { StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); Intent intent = new Intent(MediaStore.ActionImageCapture); _file = new Java.IO.File(_dir, string.Format("myPhoto_{0}.jpg", Guid.NewGuid())); intent.PutExtra(MediaStore.ExtraOutput, Android.Net.Uri.FromFile(_file)); StartActivityForResult(intent, 0); }
protected override void OnCreate(Bundle bundle) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; PlatformOpenTokService.Init(); base.OnCreate(bundle); Xamarin.Essentials.Platform.Init(this, bundle); progressDialog = new ProgressDialog(this); progressDialog.Indeterminate = true; progressDialog.SetProgressStyle(ProgressDialogStyle.Spinner); progressDialog.SetCancelable(false); global::Xamarin.Forms.Forms.Init(this, bundle); FormsMaps.Init(this, bundle); FormsGoogleMaps.Init(this, bundle); FirebaseApp.InitializeApp(this); Acr.UserDialogs.UserDialogs.Init(this); AiForms.Dialogs.Dialogs.Init(this); Plugin.InputKit.Platforms.Droid.Config.Init(this, bundle); Rg.Plugins.Popup.Popup.Init(this, bundle); App.Context = this; if (Intent.Extras != null) { foreach (var key in Intent.Extras.KeySet()) { if (key != null) { var value = Intent.Extras.GetString(key); } } } string url = ""; if (MessagingService.WebContentList != null) { if (MessagingService.WebContentList.ContainsKey("Url")) { url = MessagingService.WebContentList["Url"]; } MessagingService.WebContentList = null; } var id = Intent.GetStringExtra("id"); var message = Intent.GetStringExtra("message"); var code = Intent.GetStringExtra("code"); StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); builder.DetectFileUriExposure(); LoadApplication(new App(id, message, code, url)); }
// public static List<SubmitModel> summarydata = new List<SubmitModel>(); public override void OnCreate(Bundle savedInstanceState) { StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); im_model = new List <TaskOutboxModel>(); StrictMode.SetVmPolicy(builder.Build()); StrictMode.ThreadPolicy.Builder builder1 = new StrictMode.ThreadPolicy.Builder().PermitAll(); StrictMode.SetThreadPolicy(builder1.Build()); geo = new Geolocation(); geolocation = geo.GetGeoLocation(Activity); base.OnCreate(savedInstanceState); }
protected override void OnCreate(Bundle savedInstanceState) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); base.OnCreate(savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); LoadApplication(new TestDrive.App()); }
public override void OnCreate() { if (Constants.Config.DEVELOPER_MODE && Build.VERSION.SdkInt >= BuildVersionCodes.Gingerbread) { StrictMode.SetThreadPolicy(new StrictMode.ThreadPolicy.Builder().DetectAll().PenaltyDialog().Build()); StrictMode.SetVmPolicy(new StrictMode.VmPolicy.Builder().DetectAll().PenaltyDeath().Build()); } base.OnCreate(); InitImageLoader(ApplicationContext); }
public override void OnCreate(Bundle savedInstanceState, PersistableBundle persistentState) { StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); StrictMode.ThreadPolicy.Builder builder1 = new StrictMode.ThreadPolicy.Builder().PermitAll(); StrictMode.SetThreadPolicy(builder1.Build()); base.OnCreate(savedInstanceState, persistentState); // SetContentView(Resource.Layout.SplashScreen); Log.Debug(TAG, "SplashActivity.OnCreate"); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup root = (ViewGroup)inflater.Inflate(Resource.Layout.fragment_content_addproduct, null); StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.SetVmPolicy(builder.Build()); txt_lvl_1 = root.FindViewById <TextView>(Resource.Id.txt_lvl_1); img_lvl_1 = root.FindViewById <ImageView>(Resource.Id.img_lvl_1); img_product_view = root.FindViewById <ImageView>(Resource.Id.img_product_view); txt_ProductName = root.FindViewById <EditText>(Resource.Id.txt_ProductName); btn_show_popup = root.FindViewById <Button>(Resource.Id.btn_show_popup); btn_prd_cancel = root.FindViewById <Button>(Resource.Id.btn_prd_cancel); btn_prd_cancel.Click += (sndr, argus) => Cancel_Product(sndr, argus, this.Activity); btn_prd_save = root.FindViewById <Button>(Resource.Id.btn_prd_save); btn_prd_save.Click += (sndr, argus) => Save_Product(sndr, argus, this.Activity); if (IsThereAnAppToTakePictures()) { CreateDirectoryForPictures(); btn_show_popup.Click += (sndr, argus) => Camera_Clicked(sndr, argus, this.Activity, btn_show_popup); } try { if (Arguments != null) { if (objSelectedItem == null) { objSelectedItem = new List <ItemPayloadModelWithBase64>(); } objSelectedItem = Newtonsoft.Json.JsonConvert.DeserializeObject <List <ItemPayloadModelWithBase64> >(Arguments.GetString("siteparam")); txt_lvl_1.Text = objSelectedItem[0].ItemName; img_lvl_1.SetImageBitmap(BitmapHelpers.Base64ToBitmap(objSelectedItem[0].ItemIcon)); } if (Build.VERSION.SdkInt >= Build.VERSION_CODES.M) { if (Android.Support.V4.Content.ContextCompat.CheckSelfPermission(this.Activity, Manifest.Permission.Camera) != (int)Permission.Granted || Android.Support.V4.Content.ContextCompat.CheckSelfPermission(this.Activity, Manifest.Permission.WriteExternalStorage) != (int)Permission.Granted) { Android.Support.V4.App.ActivityCompat.RequestPermissions(this.Activity, new string[] { Manifest.Permission.Camera, Manifest.Permission.WriteExternalStorage, Manifest.Permission.ReadExternalStorage }, 54); /*FragmentManager.FindFragmentById(Resource.Layout.fragment_content_addproduct).RequestPermissions(new string[] * { * Manifest.Permission.Camera, Manifest.Permission.WriteExternalStorage, * Manifest.Permission.ReadExternalStorage * }, 54);*/ } } } catch { } return(root); }