protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); SetContentView(Resource.Layout.activity_main); StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().PermitAll().Build(); StrictMode.SetThreadPolicy(policy); Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); 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); tabs = FindViewById <TabLayout>(Resource.Id.tabs); viewPager = FindViewById <ViewPager>(Resource.Id.viewpager); SetUpProductViewPager(viewPager); tabs.SetupWithViewPager(viewPager); }
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(); }
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) { base.OnCreate(bundle); StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().PermitAll().Build(); StrictMode.SetThreadPolicy(policy); var wifi = (WifiManager)GetSystemService(WifiService); var ConnectivityManager = (ConnectivityManager)GetSystemService(ConnectivityService); wifilock = wifi.CreateWifiLock(WifiMode.FullHighPerf, "WifiLock"); wifilock.Acquire(); game = new Game1( CreateUdpService(wifi, ConnectivityManager) , RuningOnAndroid: true ); if (Build.VERSION.SdkInt >= BuildVersionCodes.O) { Vibrator vibrator = (Vibrator)GetSystemService(VibratorService); Game1.AndroidVibrate = f => vibrator.Vibrate(VibrationEffect.CreateOneShot(f, VibrationEffect.DefaultAmplitude)); } else { //TODO: } SetViewFullScreen(); //PowerManager pm = (PowerManager)GetSystemService(PowerService); //this.mWakeLock = pm.NewWakeLock(WakeLockFlags.ScreenDim, "My Tag"); //this.mWakeLock.Acquire(); game.Run(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); if (Build.VERSION.PreviewSdkInt > 9) { StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().PermitAll().Build(); StrictMode.SetThreadPolicy(policy); } // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); var webView = FindViewById <WebView>(Resource.Id.webView); webView.Settings.JavaScriptEnabled = true; // Use subclassed WebViewClient to intercept hybrid native calls webView.SetWebViewClient(new HybridWebViewClient()); // Render the view from the type generated from RazorView.cshtml var model = new Model1() { Text = "Text goes here" }; var template = new RazorView() { Model = model }; var page = template.GenerateString(); // Load the rendered HTML into the view with a base URL // that points to the root of the bundled Assets folder webView.LoadDataWithBaseURL("file:///android_asset/", page, "text/html", "UTF-8", null); }
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 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); }
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); }
private void Search(string search) { // Esto es para que me permita ejecutarlo sincrónicamente. StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().PermitAll().Build(); StrictMode.SetThreadPolicy(policy); var response = HttpHelper.Post <SearchProcessItemModel[]>($"api/svc/search?text={search}"); SetValues(response.ToDictionary(p => p.Id, p => p.Name)); }
// 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); }
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 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); }
protected override void OnCreate(Bundle bundle) { try { // https://stackoverflow.com/questions/704311/android-how-do-i-investigate-an-anr // https://stackoverflow.com/questions/5513457/anr-keydispatchingtimedout-error/5513623#5513623 StrictMode.SetThreadPolicy(new StrictMode.ThreadPolicy.Builder() .DetectAll() .PenaltyLog() .Build()); StrictMode.SetVmPolicy(new StrictMode.VmPolicy.Builder() .DetectAll() .PenaltyLog() .Build()); base.OnCreate(bundle); this.debugMode = Common.IsDebugMode(this); this.log_writer = new LogFile(this, "app.log", DateTime.UtcNow.AddDays(-2)); logDebug(LogLevel.Info, "app started (+testing log)"); this.radarIntent = new Intent(this, typeof(RadarService)); SetContentView(Resource.Layout.Main); this.enableButton = FindViewById <Button>(Resource.Id.EnableButton); this.trackFileNameTextView = FindViewById <TextView>(Resource.Id.TrackFileNameTextView); this.gpsInfoTextView = FindViewById <TextView>(Resource.Id.GpsInfoTextView); this.trackInfoTextView = FindViewById <TextView>(Resource.Id.TrackInfoTextView); this.alarmInfoTextView = FindViewById <TextView>(Resource.Id.AlarmInfoTextView); this.infoTextView = FindViewById <TextView>(Resource.Id.InfoTextView); this.adapter = new ArrayAdapter <string>(this, Resource.Layout.ListViewItem, new List <string>()); ListAdapter = this.adapter; this.trackButton = FindViewById <Button>(Resource.Id.TrackButton); this.enableButton.Click += EnableButtonClicked; this.trackButton.Click += trackSelectionClicked; this.receiver = MainReceiver.Create(this); this.receiver.DistanceUpdate += Receiver_DistanceUpdate; this.receiver.AlarmUpdate += Receiver_AlarmUpdate; this.receiver.DebugUpdate += Receiver_DebugUpdate; this.logDebug(LogLevel.Verbose, "Done OnCreate"); } catch (Exception ex) { this.logDebug(LogLevel.Error, "OnCreate " + ex.ToString()); } }
private void SetupStrictMode() { #if DEBUG StrictMode.SetThreadPolicy(new StrictMode.ThreadPolicy.Builder() .DetectAll() .PenaltyLog() .Build()); StrictMode.SetVmPolicy(new StrictMode.VmPolicy.Builder() .DetectAll() .PenaltyLog() .Build()); #endif }
public Communicator() { trustAllSslContext = SSLContext.GetInstance("SSL"); trustAllSslContext.Init(null, new ITrustManager[] { new CustomX509TrustManager() }, new SecureRandom()); client = new OkHttpClient(); client.SetConnectTimeout(5, Java.Util.Concurrent.TimeUnit.Seconds); client.SetSslSocketFactory(trustAllSslContext.SocketFactory); client.SetHostnameVerifier(new CustomHostNameVerifier()); client.SetProtocols(new Protocol[] { Protocol.Http11 }); StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().PermitAll().Build(); StrictMode.SetThreadPolicy(policy); }
public override void OnCreate() { #if DEBUG if (Build.VERSION.SdkInt >= BuildVersionCodes.Gingerbread) { StrictMode.SetThreadPolicy(new StrictMode.ThreadPolicy.Builder().DetectAll().PenaltyLog().Build()); StrictMode.SetVmPolicy(new StrictMode.VmPolicy.Builder().DetectAll().PenaltyLog().Build()); } #endif base.OnCreate(); InitImageLoader(ApplicationContext); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // GetPermissionAsync(); isRecording = false; SetContentView(Resource.Layout.compliance_layout2); 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()); AudioSavePathInDevice = Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/AudioRecording.mp3"; geolocation = geo.GetGeoLocation(this); prefs = PreferenceManager.GetDefaultSharedPreferences(this); tap = geolocation.Split(","); //task_id = Intent.GetStringExtra("task_id") ?? string.Empty; //task_description = Intent.GetStringExtra("task_descrip") ?? string.Empty; //deadline = Intent.GetStringExtra("deadline") ?? string.Empty; //task_name = Intent.GetStringExtra("task_name") ?? string.Empty; //markby = Intent.GetStringExtra("mark_by") ?? string.Empty; //creationdate = Intent.GetStringExtra("creation_date") ?? string.Empty; //taskcreatedby = Intent.GetStringExtra("created_by") ?? string.Empty; camera = FindViewById <ImageButton>(Resource.Id.imageButton1); videobutton = FindViewById <ImageButton>(Resource.Id.imageButton2); location = FindViewById <ImageButton>(Resource.Id.imageButton4); mike = FindViewById <ImageButton>(Resource.Id.imageButton3); imagecaptured = FindViewById <ImageView>(Resource.Id.imageView1); description = FindViewById <EditText>(Resource.Id.ed2); rl2 = FindViewById <LinearLayout>(Resource.Id.rl2); rl3 = FindViewById <LinearLayout>(Resource.Id.rl3); rl4 = FindViewById <LinearLayout>(Resource.Id.rl4); mike.Click += delegate { recording(); }; location.Click += delegate { //CheckForLocation(); }; string path = Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/test.mp4"; camera.Click += BtnCamera_Click; videobutton.Click += VideoClick; getData(); }
// Initialize communications, internal void InitComms() { if (socket == null) { // We wish to time how long this whole operation takes. stopwatch = System.Diagnostics.Stopwatch.StartNew(); // Allow networking on the main thread. StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().PermitAll().Build(); StrictMode.SetThreadPolicy(policy); socket = new CommSocket(); socket.ConnectToServer(); } }
// ExpandableListView mainList; //string[] Noticeitems; //RecyclerView mRecycleView; //RecyclerView.LayoutManager mLayoutManager; //PhotoAlbum mPhotoAlbum; //HomeSlider_Adapter mAdapter; 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); Activity.OverridePendingTransition(Resource.Animation.slide_up1, Resource.Animation.hold); // Create your fragment here }
protected override void OnCreate(Bundle bundle) { var policy = new StrictMode.ThreadPolicy.Builder().PermitAll().Build(); StrictMode.SetThreadPolicy(policy); ToolbarResource = Resource.Layout.toolbar; TabLayoutResource = Resource.Layout.tabs; base.OnCreate(bundle); // workaround for app compat bug // ref https://forums.xamarin.com/discussion/62414/app-resuming-results-in-crash-with-formsappcompatactivity Task.Delay(10).Wait(); Console.WriteLine("A OnCreate"); Window.SetSoftInputMode(SoftInput.StateHidden); Window.AddFlags(WindowManagerFlags.Secure); var appIdService = Resolver.Resolve <IAppIdService>(); var authService = Resolver.Resolve <IAuthService>(); HockeyApp.Android.CrashManager.Register(this, HockeyAppId, new HockeyAppCrashManagerListener(appIdService, authService)); Forms.Init(this, bundle); typeof(Color).GetProperty("Accent", BindingFlags.Public | BindingFlags.Static) .SetValue(null, Color.FromHex("d2d6de")); LoadApplication(new App.App( Resolver.Resolve <IAuthService>(), Resolver.Resolve <IConnectivity>(), Resolver.Resolve <IUserDialogs>(), Resolver.Resolve <IDatabaseService>(), Resolver.Resolve <ISyncService>(), Resolver.Resolve <IFingerprint>(), Resolver.Resolve <ISettings>(), Resolver.Resolve <ILockService>(), Resolver.Resolve <IGoogleAnalyticsService>(), Resolver.Resolve <ILocalizeService>())); MessagingCenter.Subscribe <Xamarin.Forms.Application>(Xamarin.Forms.Application.Current, "RateApp", (sender) => { RateApp(); }); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_main); //Allow network calls on the main thread StrictMode.SetThreadPolicy(new StrictMode.ThreadPolicy.Builder().PermitAll().Build()); var btnGetJava = FindViewById(Resource.Id.btn_get_java); var btnGetNet = FindViewById(Resource.Id.btn_get_net); var btnConvertJson = FindViewById(Resource.Id.btn_convertjson); btnGetJava.SetOnClickListener(this); btnGetNet.SetOnClickListener(this); btnConvertJson.SetOnClickListener(this); }
protected override void OnCreate(Bundle savedInstanceState) { ListRadio aListRadio = new ListRadio(Intent.GetStringExtra(Category)); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.DefaultListViewer); StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().PermitAll().Build(); StrictMode.SetThreadPolicy(policy); // Getting Country wise Channel List ListView myListView = FindViewById <ListView>(Resource.Id.DefaultListView); RadioChannelLst = aListRadio.GetCountryWiseRadio(); myListView.Adapter = GetAdapter(); myListView.ItemClick += MyListView_ItemClick; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); ActionBar.Hide(); IP_ADDR = (Intent.GetStringExtra("IPAddress") == "" ? "192.168.100.7" : Intent.GetStringExtra("IPAddress")); deviceWidth = 320; // Resources.DisplayMetrics.WidthPixels; deviceHeight = 240; // Resources.DisplayMetrics.HeightPixels; StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().PermitAll().Build(); StrictMode.SetThreadPolicy(policy); InitializeCameraView(); InitializeControls(); InitializeSocket(); }
public override void OnCreate() { base.OnCreate(); // make sure we aren't loading anything wrong StrictMode.SetThreadPolicy(new StrictMode.ThreadPolicy.Builder() .DetectDiskReads() .DetectDiskWrites() .DetectNetwork() // or .DetectAll() for all detectable problems .PenaltyLog() .Build()); StrictMode.SetVmPolicy(new StrictMode.VmPolicy.Builder() .DetectLeakedSqlLiteObjects() .DetectLeakedClosableObjects() .PenaltyLog() .PenaltyDeath() .Build()); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_main); 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()); Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); prefs = PreferenceManager.GetDefaultSharedPreferences(ApplicationContext); dba = new DBHelper(); service = new ServiceHelper(); con = new InternetConnection(); geo = new Geolocation(); ic = new BlobFileUpload(this); 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); View header = navigationView.GetHeaderView(0); string userName = prefs.GetString("UserName", ""); string number = prefs.GetString("MobileNumber", ""); TextView name1 = (TextView)header.FindViewById(Resource.Id.nameInst); TextView mobile1 = (TextView)header.FindViewById(Resource.Id.numberInst); name1.Text = userName; mobile1.Text = number; DisplayLocationSettingsRequest(); SupportFragmentManager.BeginTransaction().Replace(Resource.Id.container, new GSTNVerification()).Commit(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.activity_home); StrictMode.SetVmPolicy(new StrictMode.VmPolicy.Builder().DetectActivityLeaks().PenaltyLog().Build()); StrictMode.SetThreadPolicy(new StrictMode.ThreadPolicy.Builder().DetectAll().PenaltyLog().Build()); base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.activity_home); //_bottomBar = FindViewById<BottomNavigationView>(Resource.Id.bottom_navigation); //Observable.FromEventPattern<NavigationItemSelectedEventArgs>( // handler => _bottomBar.NavigationItemSelected += handler, // handler => _bottomBar.NavigationItemSelected -= handler // ) // .Select(x => x.EventArgs) // .Subscribe((args) => // { // switch (args.Item.ItemId) // { // case Resource.Id.action_team: // break; // case Resource.Id.action_tournaments: // break; // case Resource.Id.action_transfers: // SupportFragmentManager.BeginTransaction() // .SetTransitionStyle((int)FragmentTransit.FragmentFade) // .Replace(Resource.Id.fl_content, new MyTransfersFragment()) // .Commit(); // break; // case Resource.Id.action_stats: // break; // case Resource.Id.action_profile: // break; // } // }); }
// This Function will call when application will loaded protected override void OnCreate(Bundle savedInstanceState) { ListRadio aListRadio = new ListRadio(); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Main); StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().PermitAll().Build(); StrictMode.SetThreadPolicy(policy); // Get Country category to load on landing page MenuLst = aListRadio.GetAllCountry(); myListView = FindViewById <ListView>(Resource.Id.DefaultMenuListView); // Fill listview throw Adapter myListView.Adapter = GetAdapter(); // Added Event on Country click myListView.ItemClick += MyListView_ItemClick; }
protected override async void OnCreate(Bundle savedInstanceState) { StrictMode.SetThreadPolicy(new StrictMode.ThreadPolicy.Builder().DetectAll().PenaltyLog().Build()); StrictMode.SetVmPolicy(new StrictMode.VmPolicy.Builder().DetectLeakedSqlLiteObjects().DetectLeakedClosableObjects().PenaltyLog().PenaltyDeath().Build()); TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; CrossCurrentActivity.Current.Init(this, savedInstanceState); base.OnCreate(savedInstanceState); //await CrossMedia.Current.Initialize(); Plugin.InputKit.Platforms.Droid.Config.Init(this, savedInstanceState); Plugin.CurrentActivity.CrossCurrentActivity.Current.Init(this, savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); CarouselViewRenderer.Init(); UserDialogs.Init(this); LoadApplication(new App()); }
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); restService = new ServiceHelper(); geo = new Geolocation(); db = new DbHelper(); ic = new InternetConnection(); blob = new BlobFileUpload(); geolocation = geo.GetGeoLocation(Activity); tap = geolocation.Split(','); prefs = PreferenceManager.GetDefaultSharedPreferences(Activity); isRecording = false; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.ToolPage); mContext = this; MobileBarcodeScanner.Initialize(Application); //初始化二维码扫描仪 StrictMode.SetThreadPolicy(new StrictMode.ThreadPolicy.Builder() .DetectDiskReads().DetectDiskWrites().DetectNetwork() // or // .detectAll() // for // all // detectable // problems .PenaltyLog().Build()); StrictMode.SetVmPolicy(new StrictMode.VmPolicy.Builder() .DetectLeakedSqlLiteObjects().PenaltyLog().PenaltyDeath() .Build()); portText = (EditText)FindViewById(Resource.Id.portText); portText.Text = "16908"; portText.InputType = Android.Text.InputTypes.Null; pagelayout = (RelativeLayout)FindViewById((Resource.Id.PageLayout)); messagelayout = (RelativeLayout)FindViewById(Resource.Id.messageLayout); clearButton = (Button)FindViewById(Resource.Id.ClearButton); clearButton.Click += ClearButton_Click; createButton = (Button)FindViewById(Resource.Id.CreateConnect); createButton.Click += CreateButton_Click; messageText = (TextView)FindViewById(Resource.Id.messageText); messageText.MovementMethod = ScrollingMovementMethod.Instance; hidemessageButton = (Button)FindViewById(Resource.Id.HideMessageButton); hidemessageButton.Click += HidemessageButton_Click; }