private static final String MAIL_ATTACHMENT_TYPE = "text/plain";
+ private static final String KEY_LOG_TEXT = "LOG_TEXT";
+
private static final String TAG = LogHistoryActivity.class.getSimpleName();
private static final String DIALOG_WAIT_TAG = "DIALOG_WAIT";
private String mLogPath = FileStorageUtils.getLogPath();
private File logDIR = null;
+ private String mLogText;
@Override
actionBar.setDisplayHomeAsUpEnabled(true);
Button deleteHistoryButton = (Button) findViewById(R.id.deleteLogHistoryButton);
Button sendHistoryButton = (Button) findViewById(R.id.sendLogHistoryButton);
+ TextView logTV = (TextView) findViewById(R.id.logTV);
deleteHistoryButton.setOnClickListener(new OnClickListener() {
}
});
- if (mLogPath != null) {
- logDIR = new File(mLogPath);
- }
-
- if (logDIR != null && logDIR.isDirectory()) {
- // Show a dialog while log data is being loaded
- showLoadingDialog();
-
- TextView logTV = (TextView) findViewById(R.id.logTV);
+ if (savedInstanceState == null) {
+ if (mLogPath != null) {
+ logDIR = new File(mLogPath);
+ }
- // Start a new thread that will load all the log data
- LoadingLogTask task = new LoadingLogTask(logTV);
- task.execute();
+ if (logDIR != null && logDIR.isDirectory()) {
+ // Show a dialog while log data is being loaded
+ showLoadingDialog();
+ // Start a new thread that will load all the log data
+ LoadingLogTask task = new LoadingLogTask(logTV);
+ task.execute();
+ }
+ } else {
+ mLogText = savedInstanceState.getString(KEY_LOG_TEXT);
+ logTV.setText(mLogText);
}
}
if (textViewReference != null && result != null) {
final TextView logTV = textViewReference.get();
if (logTV != null) {
- logTV.setText(result);
+ mLogText = result;
+ logTV.setText(mLogText);
dismissLoadingDialog();
}
}
loading.dismiss();
}
}
+
+ @Override
+ protected void onSaveInstanceState(Bundle outState) {
+ super.onSaveInstanceState(outState);
+
+ /// global state
+ outState.putString(KEY_LOG_TEXT, mLogText);
+ }
}
\ No newline at end of file