Rikardit.files.wordpress.com
package com.example.test5;
import android.app.Activity;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.TextView;
import android.widget.Toast;
public class Test5Activity extends Activity {
/** Called when the activity is first created. */
Button btnCalcKj=null;
Button btnCalcKcal=null;
EditText edTxtNumKcal=null;
EditText edTxtNumKj=null;
TextView tvCompKj=null;
TextView tvCompKcal=null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
btnCalcKj=(Button)findViewById(R.id.btnCalcKj);
btnCalcKcal=(Button)findViewById(R.id.btnCalcKcal);
edTxtNumKcal=(EditText)findViewById(R.id.edTxtNumKcal);
edTxtNumKj=(EditText)findViewById(R.id.edTxtNumKj);
tvCompKcal=(TextView)findViewById(R.CompKcal);
tvCompKj=(TextView)findViewById(R.CompKj);
tvCompKcal.setText("");
tvCompKj.setText("");
btnCalcKcal.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
try{
// Perform action on click
double numKcal=calcNumKcal(Double.parseDouble(""+edTxtNumKj.getText()) );
tvCompKcal.setText(""+numKcal);
tvCompKj.setText("");
edTxtNumKcal.setText("");
edTxtNumKj.setText("");
}
catch(Exception e){
}
}
});
btnCalcKj.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// Perform action on click
try{
double numKj=calcNumKj(Double.parseDouble(""+edTxtNumKcal.getText()) );
tvCompKj.setText(""+numKj);
tvCompKcal.setText("");
edTxtNumKj.setText("");
edTxtNumKcal.setText("");}
catch(Exception e){
}
}
});
}
private double calcNumKj(double Kcal){
return Kcal*4.12;
}
private double calcNumKcal(double Kj){
return Kj/4.12;
}
}
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- wordpress passing data between pages
- wordpress business templates
- wordpress rss feed not working
- wordpress jquery is not defined
- create wordpress blog
- wordpress roles editor
- wordpress full rss feed
- wordpress rss feed settings
- wordpress rss feed plugin
- wordpress display rss feed
- wordpress rss feed link
- wordpress rss feed to post