package com.example.getconfig;

import android.app.Activity;
import android.content.res.Configuration;
import android.os.Bundle;
import android.widget.TextView;

import java.lang.reflect.Field;
import java.lang.reflect.Modifier;

public class MyActivity extends Activity {
	/**
	 * Called when the activity is first created.
	 */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		Configuration config = getResources().getConfiguration();
//		TextView tv = (TextView)findViewById(R.id.text_config);
//		tv.setText(config.toString());
		displayConfig();
	}

	private void displayConfig() {
		Configuration config = getResources().getConfiguration();
		Field[] fields = config.getClass().getDeclaredFields();
		StringBuilder str = new StringBuilder();
		try {
			for(Field field: fields) {
				final int modifier = field.getModifiers();
				if (!Modifier.isStatic(modifier)) {
					str.append(field.getName());
					str.append(":");
					str.append(field.get(config));
					str.append("\n");
				}
			}
		} catch (IllegalAccessException e) {
			//この補足処理が正しいかどうかは不明
			throw new RuntimeException(e);
		}
		TextView tv = (TextView)findViewById(R.id.text_config);
		tv.setText(str.toString());
	}
}

@@ -520,103 +520,8 @@
 ();%0A
-//%09%09TextView tv = (TextView)findViewById(R.id.text_config);%0A//%09%09tv.setText(config.toString());%0A
 %09%09di
@@ -1031,25 +1031,63 @@
 %09%09//
-%E3%81%93%E3%81%AE%E8%A3%9C%E8%B6%B3%E5%87%A6%E7%90%86%E3%81%8C%E6%AD%A3%E3%81%97%E3%81%84%E3%81%8B%E3%81%A9%E3%81%86%E3%81%8B%E3%81%AF%E4%B8%8D%E6%98%8E
+I don' think if throwing this exception is appropriate.
 %0A%09%09%09

Modify comments