1 year ago

#30581

test-img

İsmail Kocacan

Android Multi Window (Free-Form Mode) Resize Events

Stating an application with multi-window mode like below.

  private  void startApplication() {
    Intent intent = getPackageManager().getLaunchIntentForPackage("com.example.comisotest2"); 
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK  |
                    Intent.FLAG_ACTIVITY_MULTIPLE_TASK );


    Rect rect = new Rect(500, 300, 100, 0);

    ActivityOptions activityOptions = ActivityOptions.makeBasic();
    ActivityOptions bounds = options.setLaunchBounds(rect);

    startActivity(intent,bounds.toBundle());
}

I want to handle open window resize events. and I added onConfigurationChanged method.

    @Override
public void onConfigurationChanged(@NonNull Configuration newConfig) {
    super.onConfigurationChanged(newConfig);

    Toast.makeText(this, "newConfig.screenHeightDp:"+Integer.toString(newConfig.screenHeightDp), Toast.LENGTH_SHORT).show();
    Toast.makeText(this, "newConfig.screenWidthDp:"+Integer.toString(newConfig.screenWidthDp), Toast.LENGTH_SHORT).show();

    if(newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE){
        Toast.makeText(this, "LANDSCAPE", Toast.LENGTH_SHORT).show();

    }else{
        Toast.makeText(this, "PORTRAIT", Toast.LENGTH_SHORT).show();
    }
}

onConfigurationChanged handler is not calling.

I there any way handle all windows resize changes ?

android

multi-window

0 Answers

Your Answer

Accepted video resources