Расчтеный модуль. Не могу понять что не так
Добавлено: 15 дек 2013, 19:44
Что-то я запутаться надо сделать расчет
вот код (привожу весь что было понятно что к чему
tV1.setText(resR1);
tV2.setText(resR1); - пишет что нельзя задать из флоута. Что я не так делаю?
вот код (привожу весь что было понятно что к чему
Код: Выделить всё
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
public class recept extends Activity implements OnClickListener {
TextView tV1, tV2, tV3;
ImageView iV1;
EditText eT1;
String rec, ingr1, ingr2, ves;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.respt1);
tV1 = (TextView) findViewById(R.id.tV1);
tV2 = (TextView) findViewById(R.id.tV2);
tV3 = (TextView) findViewById(R.id.tV3);
eT1 = (EditText) findViewById(R.id.eT1);
iV1 = (ImageView) findViewById(R.id.iV1);
Bundle extras = getIntent().getExtras();
rec = extras.getString("RECEPT_TEXT");
ingr1 = extras.getString("ING1");
ingr1 = extras.getString("ING2");
ves = extras.getString("VES");
Integer imgRec = extras.getInt("REC_IMG");
Integer vihodProdukt = extras.getInt("VES");
iV1.setImageResource(imgRec);
eT1.setText(vihodProdukt);
}
private void resus() {
float c = 1000;
float vVes = 0;
float k = vVes / c;
float res1 = 0;
float res2 = 0;
float resR1 = 0;
float resR2 = 0;
vVes = Float.parseFloat(eT1.getText().toString());
res1 = Float.parseFloat(ingr1.toString());
res2 = Float.parseFloat(ingr2.toString());
k = vVes / c;
resR1 = res1 * k;
resR2 = res2 * k;
tV1.setText(resR1);
tV2.setText(resR1);
}
tV2.setText(resR1); - пишет что нельзя задать из флоута. Что я не так делаю?