我的程序应该将 bname 更改为位置,但由于某种原因我不会将位置发送到 Record Expeance 这个 waycase R.id.record_expeance:
startActivity(new Intent(BudgetStart.this, RecordExpeance.class));
ex.changeName(position);
BudgetStart.this.finish();
break;
之后应该等于位置,但它仍然是空的
package budget.app;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class RecordExpeance extends Activity implements OnClickListener
{
private String bname;
protected void onCreate(Bundle savedInstanceState)
{
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.recordexpeance);
final BudgetDB entry = new BudgetDB(RecordExpeance.this);
EditText a =(EditText)findViewById(R.id.txtExpeance);
EditText b =(EditText)findViewById(R.id.txtEMomo);
TextView c =(TextView)findViewById(R.id.lblBudgetAmount);
TextView d =(TextView)findViewById(R.id.lblBudgetName);
d.setText(bname);
String bamount;
entry.open();
bamount = entry.getBamount(bname);
entry.close();
Button A = (Button)findViewById(R.id.btnFinish);
A.setOnClickListener(this);
}
public void onClick(View argo)
{
// TODO Auto-generated method stub
startActivity(new Intent(RecordExpeance.this, BudgetStart.class));
RecordExpeance.this.finish();
}
public void changeName(String position)
{
// TODO Auto-generated method stub
bname = position;
}
}