javaide
javaide copied to clipboard
Deleted open files' contents!
Greetings,
I was busy trying to test some code and I went out of the app to check the weather, and went I went back to the app all the contents of my open files were blank! I closed the files without saving and reopened but they were overwritten! This really would suck big time if it was a project with tons of code, luckily it was something I had just created.
This might be related to a problem I'm having. Twice I was working on code and I turned, moving my phone sideways suddenly, and my code files went blank and nothing I tried restored the text.
It's rare but happened to me 2 times
This project are no longer maintained, =(
Any debug information would be useful for anyone willing to patch this bug
这是来自maxpixel的自动回复尊敬的用户,你好,请不要回复这个邮箱。如果您回复了这个邮箱,将不会得到任何有关您邮箱内容的答复,请见谅。如果对我们感兴趣请访问:maxpixel.top
this code should be used to fix this issue or something like it
private static final String KEY_YOUR_VALUE = "yourValue";
private int yourValue;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (savedInstanceState != null) {
yourValue = savedInstanceState.getInt(KEY_YOUR_VALUE);
// Restore your activity state here
} else {
// Initialize your activity for the first time
}
}
@Override
protected void onSaveInstanceState(Bundle outState) {
outState.putInt(KEY_YOUR_VALUE, yourValue);
super.onSaveInstanceState(outState);
}
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
yourValue = savedInstanceState.getInt(KEY_YOUR_VALUE);
// Restore your activity state here
}
}
Thanks a lot!