December 6, 2016

Age Calcuator

Hello guys i am struggling to do an age calculator app with Android studio..That’s my code:

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

Button btnClick;
Button btnReset;

TextView txtResult;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

btnClick=(Button)findViewById(R.id.buttonClick);
btnReset=(Button)findViewById(R.id.buttonReset);
txtResult=(TextView)findViewById(R.id.textViewResult);

btnClick.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

}
});

}
}

I dont know how to do the calculation to calculate the someones age. Actually i know that i have to subtract from 2016 the age that the person is born

Category : Uncategorized

Leave a Reply

Your email address will not be published. Required fields are marked *

Proudly powered by Bolkya Resha and Software Testing Theme