Activity configuration changed event
package app.test;
import android.app.Activity;
import android.content.res.Configuration;
import android.os.Bundle;
import android.text.Html;
import android.widget.TextView;
import android.widget.Toast;
public class Test extends Activity {
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
String rString = "message";
String fString = String.format(rString, "Collaborate and listen.");
CharSequence styledString = Html.fromHtml(fString);
TextView tv = (TextView)findViewById(R.id.myTextView);
tv.setText(styledString);
setContentView(R.layout.main);
Toast.makeText(this, "Error", Toast.LENGTH_LONG).show();
}
@Override
public void onConfigurationChanged(Configuration _newConfig) {
super.onConfigurationChanged(_newConfig);
if (_newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
}
if (_newConfig.keyboardHidden == Configuration.KEYBOARDHIDDEN_NO) {
}
}
@Override
public void onRestoreInstanceState(Bundle savedInstanceState) {
super.onSaveInstanceState(savedInstanceState);
}
@Override
public void onRestart(){
super.onRestart();
}
@Override
public void onStart(){
super.onStart();
}
@Override
public void onResume(){
super.onResume();
}
@Override
public void onSaveInstanceState(Bundle savedInstanceState) {
super.onSaveInstanceState(savedInstanceState);
}
@Override
public void onPause(){
super.onPause();
}
@Override
public void onStop(){
super.onStop();
}
@Override
public void onDestroy(){
super.onDestroy();
}
}
//main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="@+id/myTextView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
</LinearLayout>
Related examples in the same category