package com.inforhomex.auditor;
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;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
private EditText editText1;
private TextView textView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toast.makeText(this,"Creando App",Toast.LENGTH_SHORT).show();
editText1 = (EditText) findViewById(R.id.editText1);
textView = (TextView) findViewById(R.id.textView);
}
public void celsius(View view){
String valor1 = editText1.getText().toString();
double calculo = (Double.parseDouble(valor1) * 1.8) + 32;
String resultado = String.valueOf(calculo);
Toast.makeText(this,"Fahrenheit = "+resultado,Toast.LENGTH_SHORT).show();
textView.setText(resultado);
editText1.setText("");
}
@Override
protected void onStart(){
super.onStart();
Toast.makeText(this,"Iniciando App",Toast.LENGTH_SHORT).show();
}
@Override
protected void onResume(){
super.onResume();
Toast.makeText(this,"Resumiendo App",Toast.LENGTH_SHORT).show();
}
@Override
protected void onPause(){
super.onPause();
Toast.makeText(this,"Pausando App",Toast.LENGTH_SHORT).show();
}
@Override
protected void onStop(){
super.onStop();
Toast.makeText(this,"Deteniendo App",Toast.LENGTH_SHORT).show();
}
@Override
protected void onDestroy(){
super.onDestroy();
Toast.makeText(this,"Destruyendo App",Toast.LENGTH_SHORT).show();
}
}
Código hecho con Android Studio y Java
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.