Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- onRestart()
- onStart()
- onResume()
- onPostResume()
- package ravindra.projects.my_app_1;
- import android.content.Intent;
- import android.content.IntentFilter;
- import android.os.PersistableBundle;
- import android.support.v7.app.AppCompatActivity;
- import android.os.Bundle;
- import android.util.Log;
- import android.view.View;
- import android.widget.Button;
- import android.widget.EditText;
- import android.widget.TextView;
- public class MainActivity extends AppCompatActivity implements View.OnClickListener{
- private EditText txtUserName;
- private EditText txtPassword;
- Button loginButton;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- Log.d("Ravi","Main OnCreate");
- txtUserName=(EditText) findViewById(R.id.username);
- txtPassword=(EditText) findViewById(R.id.password);
- loginButton = (Button) findViewById(R.id.login);
- loginButton.setOnClickListener(this);
- }
- @Override
- public void onClick(View view) {
- Log.d("Ravi", "Login processing initiated");
- Intent intent = new Intent(this,LoginActivity.class);
- Bundle bundle = new Bundle();
- bundle.putString("userName",txtUserName.getText().toString());
- bundle.putString("password",txtPassword.getText().toString());
- intent.putExtras(bundle);
- startActivityForResult(intent,1);
- // IntentFilter
- }
- public void onActivityResult(int requestCode, int resultCode, Intent resIntent){
- Log.d("Ravi back result:", "start");
- String result = resIntent.getStringExtra("result");
- Log.d("Ravi back result:", result);
- TextView txtView = (TextView)findViewById(R.id.txtView);
- txtView.setText(result);
- }
- @Override
- protected void onStart() {
- super.onStart();
- Log.d("Ravi","Main Start");
- }
- @Override
- protected void onRestart() {
- super.onRestart();
- Log.d("Ravi","Main ReStart");
- }
- @Override
- protected void onPause() {
- super.onPause();
- Log.d("Ravi","Main Pause");
- }
- @Override
- protected void onResume() {
- super.onResume();
- Log.d("Ravi","Main Resume");
- }
- @Override
- protected void onStop() {
- super.onStop();
- Log.d("Ravi","Main Stop");
- }
- @Override
- protected void onDestroy() {
- super.onDestroy();
- Log.d("Ravi","Main OnDestroy");
- }
- @Override
- protected void onPostResume() {
- super.onPostResume();
- Log.d("Ravi","Main PostResume");
- }
- @Override
- public void onSaveInstanceState(Bundle outState, PersistableBundle outPersistentState) {
- super.onSaveInstanceState(outState, outPersistentState);
- }
- @Override
- protected void onRestoreInstanceState(Bundle savedInstanceState) {
- super.onRestoreInstanceState(savedInstanceState);
- }
- }
- onRestart()
- onStart()
- onResume()
- onRestart()
- onStart()
- onResume()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement