import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class ActionOne extends Activity {
TextView textOutTilesNeeded, newWidth, newHeight, newArea;
EditText getInputW, getInputH, getInputArea;
float width, height, area, tilesNeeded;
String tilesNeededString, intWidth, intHeight, intArea;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.tile);
textOutTilesNeeded = (TextView) findViewById(R.id.lblTilesNeeded);
newWidth = (EditText) findViewById(R.id.txtTileWidth);
newHeight = (EditText) findViewById(R.id.txtTileHeight);
newArea = (EditText) findViewById(R.id.txtArea2cover);
getInputW = (EditText) findViewById(R.id.txtTileWidth);
getInputH = (EditText) findViewById(R.id.txtTileHeight);
getInputArea = (EditText) findViewById(R.id.txtArea2cover);
Button enter = (Button) findViewById(R.id.btnEnterTile);
enter.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// String string_to_float="1234.89";
// float flt=Float.parseFloat(string_to_float);
// EditText et = (EditText) findViewById(R.id.entry1);
//String hello = et.getText().toString();
intWidth = getInputW.getText().toString();
intHeight = getInputH.getText().toString();
intArea = getInputArea.getText().toString();
// TODO Auto-generated method stub
width = Float.parseFloat(intWidth);
height = Float.parseFloat(intHeight);
area = Float.parseFloat(intArea);
tilesNeeded = ((area)/(width*height));
tilesNeededString = String.valueOf(tilesNeeded);
textOutTilesNeeded.setText(tilesNeededString);
}
private float StringToFloat(String intWidth) {
// TODO Auto-generated method stub
return 0;
}
});
}
// so we can use: onPause, onCreate, etc
}