这是我的代码。当我选择多个“swdetails”时,只有最后一个工作。其他人设置文字不起作用。我是Android开发的新手。寻找一些帮助。
swdetails = getArguments().getBooleanArray("service");
final String s = getArguments().getString("snote");
cdata = getArguments().getStringArray("cdata");
grdm = (GridLayout) rootView.findViewById(R.id.setmain);
if (swdetails[0]) {
GridLayout grdv = (GridLayout) View.inflate(
rootView.getContext(),
R.layout.grdcctv, null);
AsyncTaskRunner runner = new AsyncTaskRunner();
runner.execute("cctvid", "rcisl_clients_cctv");
finalResult = (EditText) grdv
.findViewById(R.id.txtcctv);
grdm.addView(grdv);
}
if (swdetails[1]) {
GridLayout grdv = (GridLayout) View.inflate(
rootView.getContext(),
R.layout.grdsolar, null);
AsyncTaskRunner runner = new AsyncTaskRunner();
runner.execute("solarid", "rcisl_clients_solar");
finalResult = (EditText) grdv
.findViewById(R.id.txtsolarid);
grdm.addView(grdv);
}
if (swdetails[2]) {
GridLayout grdv = (GridLayout) View.inflate(
rootView.getContext(),
R.layout.grdintercom, null);
AsyncTaskRunner runner = new AsyncTaskRunner();
runner.execute("intercomid", "rcisl_clients_intercom");
finalResult = (EditText) grdv
.findViewById(R.id.txtintercomid);
grdm.addView(grdv);
}