onConfigurationChanged() called when window size changed in Multi-Window Mode

onConfigurationChanged() called when window size changed in Multi-Window Mode - Hello Friend GENERAL INFO FOR ANDROID DEVELOPMENT, In the article you read this time with the title onConfigurationChanged() called when window size changed in Multi-Window Mode, We have prepared this article for you to read and retrieve information there in. Hopefully the contents of postings Artikel MultiWindowMode, We write this you can understand. Alright, good read.

The Title : onConfigurationChanged() called when window size changed in Multi-Window Mode
link : onConfigurationChanged() called when window size changed in Multi-Window Mode

Read also


onConfigurationChanged() called when window size changed in Multi-Window Mode

Last post show that onMultiWindowModeChanged() will be called when your app change from Full screen mode to Multi-Window Mode, or reverse. How about size changed in Multi-Window Mode?


This example show that onConfigurationChanged() will be called in case of size changed in Multi-Window Mode.


Modify MainActivity to override onConfigurationChanged() to show a Toast.
package com.blogspot.android_er.androidmultiwindow;

import android.content.res.Configuration;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

TextView textPrompt;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
textPrompt = (TextView)findViewById(R.id.prompt);

if(isInMultiWindowMode()){
textPrompt.setText("onCreate run In Multi Window Mode ");
}else{
textPrompt.setText("onCreate run NOT In Multi Window Mode ");
}

Toast.makeText(MainActivity.this,
"onCreate() called", Toast.LENGTH_LONG).show();
}

@Override
public void onMultiWindowModeChanged(boolean isInMultiWindowMode) {
super.onMultiWindowModeChanged(isInMultiWindowMode);

if(isInMultiWindowMode){
textPrompt.setText("It is In Multi Window Mode ");
}else{
textPrompt.setText("It is NOT In Multi Window Mode ");
}

Toast.makeText(MainActivity.this,
"onMultiWindowModeChanged() called", Toast.LENGTH_LONG).show();
}

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

Toast.makeText(MainActivity.this,
"onConfigurationChanged() called", Toast.LENGTH_LONG).show();
}
}


The layout file keep using that in last post.

The AndroidManifest.xml in this example use the default setting by Android Studio without any changed.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.blogspot.android_er.androidmultiwindow">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>

Next:
Get display information using DisplayMetrics, in Multi-Window Mode



Thus Article onConfigurationChanged() called when window size changed in Multi-Window Mode

The End Article onConfigurationChanged() called when window size changed in Multi-Window Mode This time, hopefully can give benefits to all of you. well, see you in posting other articles.

You are now reading the article onConfigurationChanged() called when window size changed in Multi-Window Mode with the link address http://xorislogo.blogspot.com/2016/07/onconfigurationchanged-called-when.html

0 Response to "onConfigurationChanged() called when window size changed in Multi-Window Mode"

Post a Comment