1. Are you ready for the Galaxy S20? Here is everything we know so far!

How to start Activity from Android Keyboard (IME) on MIUI 11 without asking permission from user?

Discussion in 'Android Development' started by Ravindra Pal Singh, Jun 2, 2020.

  1. Ravindra Pal Singh

    Thread Starter


    Code (Java):
    1.     final Intent intent = new Intent( mRichImm.getInputMethodInfoOfThisIme().getSettingsActivity());
    2. intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
    3.         | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
    4.         | Intent.FLAG_ACTIVITY_CLEAR_TOP);
    5. intent.addCategory(Intent.CATEGORY_LAUNCHER);
    6. final int currentDisplayId = ((WindowManager) getSystemService(Context.WINDOW_SERVICE))
    7.         .getDefaultDisplay().getDisplayId();
    8. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    9.   if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
    10.     context.startActivity(intent,
    11.             ActivityOptions.makeBasic().setLaunchDisplayId(currentDisplayId).toBundle());
    12.   }else{
    13.     context.startActivity(intent);
    14.   }
    15. }else{
    16.   context.startActivity(intent);
    17. }

     



    1. Download the Forums for Android™ app!


      Download

       
Loading...
Similar Threads - start Activity Android
  1. hg1
    Replies:
    3
    Views:
    416
  2. puppykickr
    Replies:
    15
    Views:
    523
  3. quentin ramecourt
    Replies:
    1
    Views:
    429
  4. crabocado
    Replies:
    8
    Views:
    694
  5. farter
    Replies:
    1
    Views:
    642
  6. kumaranil13k
    Replies:
    1
    Views:
    389
  7. Steve Moravsky
    Replies:
    1
    Views:
    338
  8. coldpumpkin
    Replies:
    2
    Views:
    412
  9. tapio
    Replies:
    5
    Views:
    658
  10. sporex
    Replies:
    0
    Views:
    458

Share This Page

Loading...