【发布时间】:2016-04-15 22:46:19
【问题描述】:
对不起,我的英语不好。我使用谷歌翻译。 我只是为android编写了一个游戏。 对于我的问题,我会在数组中进行游戏检查。 在这种情况下,显示的是支票的价值。 然后支票的金额在显示的文本编辑中并支付按钮。 当按下按钮时,在 textedit 期间支付输入的值。 但是,只有支付的总费用,没有部分金额。 我的问题是没有交给编辑过的文本。 只是从头开始显示传递的值。 为什么?我的错误在哪里? 我用数字标记了字符区域??。
for (int i = 0; i < jArray.length(); i++) {
JSONObject jObject = jArray.getJSONObject(i);
if(jObject.has("error")){
no_schecks.setVisibility(View.VISIBLE);
}else {
no_schecks.setVisibility(View.INVISIBLE);
final int scheckid = jObject.getInt("scheckid");
final String condition = jObject.getString("condition");
scheckx = new Scheck(condition, scheckid );
ll = (TableLayout) rootview.findViewById(R.id.displayLinear);
TableRow row = new TableRow(getActivity());
scheckLocalStore.storeScheckData(scheckx);
LayoutInflater inflater = getLayoutInflater(getArguments());
View theInflatedView = inflater.inflate(R.layout.activity_scheckx,
null);
TextView conditions = (TextView) theInflatedView.findViewById(R.id.condition);
conditions.setText(" " + scheckx.condition + " ₢ ");
conditions = new TextView(getActivity());
row.addView(conditions);
Log.i("info", "start?????????????????????????????");
EditText setconditions = (EditText) theInflatedView.findViewById(R.id.setcondition);
setconditions.setText(scheckx.condition);
setconditions = new EditText(getActivity());
row.addView(setconditions);
Log.i("info", "end?????????????????????????????");
Button btnSetCondition = (Button) theInflatedView.findViewById(R.id.btnSetCondition);
final String thisCondition = scheckx.condition;
final String thisId = Integer.toString(scheckx.scheckid);
final int thatId = scheckx.scheckid;
Log.i("info", "start?????????????????????????????");
//final String thatCondition = setconditions.getText().toString();
final String thatCondition = ((EditText) theInflatedView.findViewById(R.id.setcondition)).getText().toString();
Log.i("info", "end?????????????????????????????");
scheckLocalStore = new ScheckLocalStore(super.getActivity());
btnSetCondition.setId(btnSetCondition.getId());
btnSetCondition.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.btnSetCondition:
Log.i("info", "SCHECKKRAM " + thatCondition + " " + thisCondition);
Scheck scheck = new Scheck(uid, usersecu, thatId, thisCondition);
executeScheck(scheck, thatCondition, thisId);
//objFragment = new activity_bank_main();
break;
}
if(objFragment != null){
FragmentManager fragmentManager = getFragmentManager();
fragmentManager.beginTransaction()
.replace(R.id.container, objFragment)
.commit();
}
}
});
//row.setLayoutParams(TableRow.LayoutParams.MATCH_PARENT);
row.setGravity(Gravity.CENTER_HORIZONTAL);
row.addView(theInflatedView);
ll.addView(row, i);
}
}
【问题讨论】:
-
特别感谢编辑谢尔盖·格洛托夫
标签: java android arrays xml android-edittext