package com.aupadhyay.myfirstapp;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;
import android.widget.Button;
import android.widget.EditText;
public class MainActivity extends AppCompatActivity {
EditText editTextName, editTextPhone;
Button btnSubmit;
void initViews()
{
editTextName = (EditText)findViewById(R.id.editTextName);
editTextPhone = (EditText)findViewById(R.id.editTextPhone);
btnSubmit = (Button)findViewById(R.id.button);
btnSubmit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) { // v = btnSubmit;
String strName = editTextName.getText().toString().trim();
String strPhone = editTextPhone.getText().toString().trim();
Toast.makeText(MainActivity.this, "You Entered : "+strName+" : "+strPhone, Toast.LENGTH_LONG).show();
}
});
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initViews();
Toast.makeText(this, "MainActivity - onCreate",Toast.LENGTH_SHORT).show();
}
@Override
protected void onStart() {
super.onStart();
Toast.makeText(this, "MainActivity - onStart",Toast.LENGTH_SHORT).show();
}
@Override
protected void onResume() {
super.onResume();
Toast.makeText(this, "MainActivity - onResume",Toast.LENGTH_SHORT).show();
}
@Override
protected void onPause() {
super.onPause();
Toast.makeText(this, "MainActivity - onPause",Toast.LENGTH_SHORT).show();
}
@Override
protected void onStop() {
super.onStop();
Toast.makeText(this, "MainActivity - onStop",Toast.LENGTH_SHORT).show();
}
@Override
protected void onDestroy() {
super.onDestroy();
Toast.makeText(this, "MainActivity - onDestroy",Toast.LENGTH_SHORT).show();
}
@Override
protected void onRestart() {
super.onRestart();
Toast.makeText(this, "MainActivity - onRestart",Toast.LENGTH_SHORT).show();
}
}