protected override void OnCreate(Bundle savedInstance) { base.OnCreate(savedInstance); var window = GetWindow(); window.AddFlags(IWindowManager_LayoutParams.FLAG_SHOW_WHEN_LOCKED | IWindowManager_LayoutParams.FLAG_TURN_SCREEN_ON | IWindowManager_LayoutParams.FLAG_DISMISS_KEYGUARD); SetContentView(R.Layouts.MainLayout); var handler = new Handler(); handler.PostDelayed(this, 200); }
public LunarThread(LunarView view, ISurfaceHolder surfaceHolder, Context context, Handler handler) { // get handles to some important objects this.view = view; mSurfaceHolder = surfaceHolder; mHandler = handler; view.mContext = context; Resources res = context.Resources; // cache handles to our key sprites & other drawables mLanderImage = context.Resources.GetDrawable(R.Drawables.lander_plain); mFiringImage = context.Resources.GetDrawable(R.Drawables.lander_firing); mCrashedImage = context.GetResources().GetDrawable(R.Drawables.lander_crashed); // load background image as a Bitmap instead of a Drawable b/c // we don't need to transform it and it's faster to draw this way mBackgroundImage = BitmapFactory.DecodeResource(res, R.Drawables.earthrise); // Use the regular lander image as the model size for all sprites mLanderWidth = mLanderImage.IntrinsicWidth; mLanderHeight = mLanderImage.IntrinsicHeight; // Initialize paints for speedometer mLinePaint = new Paint(); mLinePaint.SetAntiAlias(true); mLinePaint.SetARGB(255, 0, 255, 0); mLinePaintBad = new Paint(); mLinePaintBad.SetAntiAlias(true); mLinePaintBad.SetARGB(255, 120, 180, 0); mScratchRect = new RectF(0, 0, 0, 0); mWinsInARow = 0; mDifficulty = DIFFICULTY_MEDIUM; // initial show-up of lander (not yet playing) mX = mLanderWidth; mY = mLanderHeight * 2; mFuel = PHYS_FUEL_INIT; mDX = 0; mDY = 0; mHeading = 0; mEngineFiring = true; }
public const int STATE_CONNECTED = 3; // now connected to a remote device /// <summary> /// Constructor. Prepares a new BluetoothChat session. </summary> /// <param name="context"> The UI Activity Context </param> /// <param name="handler"> A Handler to send messages back to the UI Activity </param> public BluetoothChatService(Context context, Handler handler) { mAdapter = BluetoothAdapter.GetDefaultAdapter(); mState = STATE_NONE; mHandler = handler; }
public AndroidSynchronizationContext() { handler = new Handler(Handler); }
public override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Retain instance to avoid reconnecting on rotate. This means that onDestroy and onCreate // will not be called on configuration changes. SetRetainInstance(true); mHandler = new PlusClientFragmentHandler(this); // Create the PlusClient. PlusClient.Builder plusClientBuilder = new PlusClient.Builder(GetActivity().GetApplicationContext(), this, this); String[] visibleActivities = GetArguments().GetStringArray(ARG_VISIBLE_ACTIVITIES); if (visibleActivities != null && visibleActivities.Length > 0) { plusClientBuilder.SetVisibleActivities(visibleActivities); } mPlusClient = plusClientBuilder.Build(); if (savedInstanceState == null) { mRequestCode = INVALID_REQUEST_CODE; } else { mRequestCode = savedInstanceState.GetInt(STATE_REQUEST_CODE, INVALID_REQUEST_CODE); } }
/// <summary> /// Default ctor /// </summary> public WorkerTask(BackgroundWorker worker, object argument) { this.worker = worker; this.argument = argument; resultHandler = new Handler(HandleWorkCompleted); progressHandler = new Handler(HandleProgress); // Start background thread var thread = new Thread(DoWork); thread.Start(); }