テーブル レイアウトとテーブル行を動的に作成し、Web サービスから値を追加するコードを作成しました。TargetInvocation
それは私に例外を与えています。この理由は何でしょうか?
protected void onPostExecute(final ArrayList<DeleteuserDetails>deleteuserDetails) {
for(int i=0;i<=deleteuserDetails.size();i++){
TableRow deleteUserRow=new TableRow(Deleteuser.this);
deleteUserRow.setId(i);
deleteUserRow.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
CheckBox select_id = new CheckBox(Deleteuser.this);
select_id.setId(i);
deleteUserRow.addView(select_id);
deleteuserList[i]=new TextView(Deleteuser.this);
deleteuserList[i].setId(i);
deleteuserList[i].setText(deleteuserDetails.get(i).getUserId());
deleteUserRow.addView(deleteuserList[i]);
uName=new TextView(Deleteuser.this);
uName.setId(i);
uName.setText(deleteuserDetails.get(i).getUserName());
deleteUserRow.addView(uName);
Userrole=new TextView(Deleteuser.this);
Userrole.setId(i);
Userrole.setText(deleteuserDetails.get(i).getUserRole());
deleteUserRow.addView(Userrole);
CreatedDate=new TextView(Deleteuser.this);
CreatedDate.setId(i);
CreatedDate.setText(deleteuserDetails.get(i).getCreatedDate());
deleteUserRow.addView(CreatedDate);
CreatedBy=new TextView(Deleteuser.this);
CreatedBy.setId(i);
CreatedBy.setText(deleteuserDetails.get(i).getCreatedBy());
deleteUserRow.addView(CreatedBy);
userdetailTable.addView(deleteUserRow,new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
select_id.setTag(i);
select_id.setOnClickListener(listener);
}
TableRow deleteUserRow1=new TableRow(Deleteuser.this);
deleteUserRow1.setId(100);
deleteUserRow1.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
Button btn_user_delete=new Button(Deleteuser.this);
btn_user_delete.setText("Delete");
deleteUserRow1.addView(btn_user_delete);
btn_user_delete.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
new DeleteUserid().execute(checkedValue);
}
});
}
IllegalStateException
ラインで上昇します
userdetailTable.addView(deleteUserRow,new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
ログキャット
12-21 15:05:44.630: E/AndroidRuntime(644): java.lang.NullPointerException
12-21 15:05:44.630: E/AndroidRuntime(644): at com.mvss.admin.Deleteuser$deteUserIdLoad.onPostExecute(Deleteuser.java:123)
12-21 15:05:44.630: E/AndroidRuntime(644): at com.mvss.admin.Deleteuser$deteUserIdLoad.onPostExecute(Deleteuser.java:1)
12-21 15:05:44.630: E/AndroidRuntime(644): at android.os.AsyncTask.finish(AsyncTask.java:417)
12-21 15:05:44.630: E/AndroidRuntime(644): at android.os.AsyncTask.access$300(AsyncTask.java:127)
12-21 15:05:44.630: E/AndroidRuntime(644): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:429)
12-21 15:05:44.630: E/AndroidRuntime(644): at android.os.Handler.dispatchMessage(Handler.java:99)
12-21 15:05:44.630: E/AndroidRuntime(644): at android.os.Looper.loop(Looper.java:123)
12-21 15:05:44.630: E/AndroidRuntime(644): at android.app.ActivityThread.main(ActivityThread.java:4627)
12-21 15:05:44.630: E/AndroidRuntime(644): at java.lang.reflect.Method.invokeNative(Native Method)
12-21 15:05:44.630: E/AndroidRuntime(644): at java.lang.reflect.Method.invoke(Method.java:521)
12-21 15:05:44.630: E/AndroidRuntime(644): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
12-21 15:05:44.630: E/AndroidRuntime(644): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
12-21 15:05:44.630: E/AndroidRuntime(644): at dalvik.system.NativeStart.main(Native Method)