Vote count:
0
So i've googled a lot, but i haven't found a solution yet... probally because every program is different.
So basically what this program does is, take the numbers enterd in edittext fields, and then multiply, subtract and all that good stuff with eachother. Heres my logcat
05-28 16:37:55.847: I/ActivityManager(274): Start proc xela.kasea.flyffresell for activity xela.kasea.flyffresell/.Main: pid=779 uid=10046 gids={50046, 1028}
So thats pretty much how that looks like, now i feel like i won't need to put the manifest in here, because i only have one class(main) and theres no way theres an error in there. note: took out package name.
Heres my class:
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.ToggleButton;
public class Main extends Activity implements OnClickListener{
EditText perin, amountPrUnit, buy, sell;
ToggleButton lazy;
Button clear, submit, ret;
double ans, subAnswer;
TextView pEarned, tAmount;
int a = Integer.parseInt(perin.getText().toString());
int b = Integer.parseInt(amountPrUnit.getText().toString());
int c = Integer.parseInt(buy.getText().toString());
int d = Integer.parseInt(sell.getText().toString());
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.display);
Log.i("Tag2", "This is my error msg");
initalizer();
lazy.setOnClickListener(this);
clear.setOnClickListener(this);
submit.setOnClickListener(this);
ret.setOnClickListener(this);
/*String a = perin.getText().toString();
String b = amountPrUnit.getText().toString();
String c = buy.getText().toString();
String d = sell.getText().toString(); */
}
private void initalizer() {
// TODO Auto-generated method stub
perin = (EditText) findViewById(R.id.etHowRich);
amountPrUnit = (EditText) findViewById(R.id.etAmountPrUnit);
buy = (EditText) findViewById(R.id.etBuying);
sell = (EditText) findViewById(R.id.etSellingPrUnit);
lazy = (ToggleButton) findViewById(R.id.tbBuying);
clear = (Button) findViewById(R.id.bClear);
submit = (Button) findViewById(R.id.bSubmit);
ret = (Button) findViewById(R.id.bReturn);
pEarned = (TextView) findViewById(R.id.tvEarned);
tAmount = (TextView) findViewById(R.id.tvAmount);
/*int a = Integer.parseInt(perin.getText().toString());
int b = Integer.parseInt(amountPrUnit.getText().toString());
int c = Integer.parseInt(buy.getText().toString());
int d = Integer.parseInt(sell.getText().toString());*/
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
switch(v.getId()){
case R.id.bClear:
perin.setText("");
amountPrUnit.setText("");
buy.setText("");
sell.setText("");
lazy.setChecked(false);
break;
case R.id.bReturn:
setContentView(R.layout.display);
break;
case R.id.bSubmit:
pEarned.setText(c*d-(a-(b*c)));
tAmount.setText(c*d+(a-(a-(b*c))));
setContentView(R.layout.finish);
break;
case R.id.tbBuying:
if (lazy.isChecked()){
buy.setText("");
double subAnswer = 0;
int ans = 0;
subAnswer = a/b;
ans = (int) Math.floor(subAnswer);
/*new Integer((int) ans).toString();
Integer.toString(answer);*/
buy.setText(ans);;
}
break;
}
}
}
asked 42 secs ago
Aucun commentaire:
Enregistrer un commentaire