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();
}
}
Sometimes the only way to move forward is to revisit the things in your past that were holding you back. You have to deal with them head on, no matter how scary they may be. Because once we do, you'll see that you can go further than you ever imagined. सो जाएँगे कल लिपटकर तिरंगे के साथ अलमारी में... देशभक्ति है साहब.... तारीखों पर जागती है। The only way out is through.
Tuesday, 12 April 2016
My First Android app MainActivity.java file
Labels:
Android
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment