Pointing to wrong UI from posted Runnable after screen orintation changes

view story

http://stackoverflow.com – This is my little test program. My problem is that from run() method I access to fields of wrong (old) Activity, which was destroyed after screen orientation changed. What's the way to handle this situation? And, by the way, I must have my activity been recreated, because in real application I have different layouts for portrait and landscape modes! public class MainActivity extends Activity { private EditText edit; private Button button; private ProgressDialog progressDialog; private boolean isLoginInProgress = false; @Override protected void onCreate(Bundle savedIns (HowTos)