当我点击任何行上的任何edittexts时 - 会出现一个对话框
然后单击对话框setText,对于单击的edittext。
但Text始终设置为平板电脑布局最后一行的edittext
请帮忙
以下是代码:
private void displayWorkOrderSearch(){
for (int i = 0; i < mExtendedSearchCollectionList.size(); i++) {
final ExtendedSearchCollection extendedSearchCollectionObj = mExtendedSearchCollectionList.get(i);
final TableRow fTableRow = new TableRow(WorkOrderSearchActivity.this);
if (extendedSearchCollectionObj.getMODULENAME().equalsIgnoreCase("WORKORDER") && extendedSearchCollectionObj.getSCREENNAME().equalsIgnoreCase("WO_SEARCH")) {
Log.e("WorkOrderSearch", " testing label" + extendedSearchCollectionObj.getUILABEL());
TextView fLabelView = CommonElements.getCreateTextView(context);
fLabelView.setText(extendedSearchCollectionObj.getUILABEL());
switch (extendedSearchCollectionObj.getUIFIELDTYPE()) {
case "ID":
fEditTextID = CommonElements.getCreateEditText(WorkOrderSearchActivity.this, extendedSearchCollectionObj.getUIFIELDTYPE());
fEditTextID.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
makeServiceCalls(extendedSearchCollectionObj.getDDCOLLECTIONNAME(), extendedSearchCollectionObj.getDDFIELDNAME(), extendedSearchCollectionObj.getDDTABNAME());
}
});
fTableRow.addView(fLabelView);
fTableRow.addView(fEditTextID);
fTableLayout.addView(fTableRow);
break;
case "TF":
EditText fEditTextTF = CommonElements.getCreateEditText(WorkOrderSearchActivity.this, extendedSearchCollectionObj.getUIFIELDTYPE());
fEditTextTF.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
}
});
fTableRow.addView(fLabelView);
fTableRow.addView(fEditTextTF);
fTableLayout.addView(fTableRow);
break;
case "DF":
EditText fEditTextDF = CommonElements.getCreateEditText(WorkOrderSearchActivity.this, extendedSearchCollectionObj.getUIFIELDTYPE());
fEditTextDF.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// text = workOrderListSearchCallBack.makeServiceCalls(extendedSearchCollectionObj.getDDCOLLECTIONNAME() ,extendedSearchCollectionObj.getDDFIELDNAME(), extendedSearchCollectionObj.getDDTABNAME());
// workOrderListSearchCallBack.getDialogList() ;
// fEditText.setText(text);
}
});
fTableRow.addView(fLabelView);
fTableRow.addView(fEditTextDF);
fTableLayout.addView(fTableRow);
break;
case "DD":
Button fButtonDD = (Button) CommonElements.getCreateButton(WorkOrderSearchActivity.this, extendedSearchCollectionObj.getUIFIELDTYPE());
fButtonDD.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
}
});
fTableRow.addView(fLabelView);
fTableRow.addView(fButtonDD);
fTableLayout.addView(fTableRow);
break;
default:
break;
}
}
}
}
对话
public void getDialogList(Boolean mFilterApplicable ) {
if(mFilterApplicable == true){
for (int i = 0; i < mDynamicDropDownList .size(); i++) {
DynamicDropDown mDynamicDropDownObj = mDynamicDropDownList.get(i);
mFieldValueDesc.add((CharSequence) (mDynamicDropDownObj.getFieldkeyvalue() + "" + mDynamicDropDownObj.getFieldkeyvalue()));
}
}
else
{
for (int i = 0; i < mCommonDropDownListCollectionList .size(); i++) {
CommonDropDownCollection mCommonDropDownCollectionObj = mCommonDropDownListCollectionList.get(i);
mFieldValueDesc.add((CharSequence) (mCommonDropDownCollectionObj.getCommonKeyValue() + "" + mCommonDropDownCollectionObj.getCommonDescvalue()));
}
}
fDDlistarray = new CharSequence[mFieldValueDesc.size()];
fDDlistarray = mFieldValueDesc.toArray(fDDlistarray);
AlertDialog.Builder builder = new AlertDialog.Builder(WorkOrderSearchActivity.this);
builder.setTitle("Make your selection");
builder.setItems(fDDlistarray, new android.content.DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
fEditTextID.setText(fDDlistarray[which].toString());
}
});
AlertDialog alert = builder.create();
alert.show();
}