I cant seem to be able to modify the view of my layouts after the first initialization of the android app in onCreate(null)
, when I minimize the app and open it up again onCreate(savedInstanceState)
, all my functions like setText
don't seem to matter
package com.example.www.i_fucking_hate_java;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.widget.EditText;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (savedInstanceState == null)
{
// this will work
((EditText) findViewById(R.id.editText)).setText("Good afternoon");
Log.d("Me", "Running 1 " + ((EditText) findViewById(R.id.editText)).getText().toString());
}
else
{
// k so we have an old instance,
// problem is now our "handles" to our EditTexts are useless
// THIS WILL NOT WORK ??????????????????????????????????????????
// the value returned by getText is correct, but the emulator display
// does not change - also I hate android
((EditText) findViewById(R.id.editText)).setText("Good night");
Log.d("Me", "Running 2 " + ((EditText) findViewById(R.id.editText)).getText().toString());
}
// // this will work
// ((EditText) findViewById(R.id.editText)).setText("Good morning");
// Log.d("Me", "Running 3 " + ((EditText) findViewById(R.id.editText)).getText().toString());
}
}