我收到 NullPointerException:
public void llenardatos(SQLiteDatabase db, int pos) {
ImgVector = new ImageView[50];
String[] id = new String[] { String.valueOf(pos + 1) };
EditText txttipo = (EditText) mContentView.findViewById(R.id.Txttipo);
EditText spalto = (EditText) mContentView.findViewById(R.id.Txtalto);
EditText splargo = (EditText) mContentView.findViewById(R.id.TxtLargo);
EditText spancho = (EditText) mContentView.findViewById(R.id.Txtancho);
EditText sobser = (EditText) mContentView
.findViewById(R.id.txtobservaciones);
EditText sphora = (EditText) mContentView.findViewById(R.id.Txthora);
EditText txtfecha = (EditText) mContentView.findViewById(R.id.txtfecha);
TextView txtlati = (TextView) mContentView
.findViewById(R.id.txtlatitud);
TextView txtlongi = (TextView) mContentView
.findViewById(R.id.txtlongitud);
Critico cr = new Critico();
cr.seleccionar(db, id);
txttipo.setText("" + cr.getTipo());
spalto.setText("" + cr.getAlto());
splargo.setText("" + cr.getLargo());
spancho.setText("" + cr.getAncho());
sobser.setText("" + cr.getObservaciones());
sphora.setText(cr.getHora());
txtfecha.setText("" + cr.getFecha());
txtlati.setText("" + cr.getLatitud());
txtlongi.setText("" + cr.getLongitud());
FotoCritico fc = new FotoCritico();
ArrayList<String> datos = fc.seleccionartodos(db, id);
int i = datos.size();
for (int contador = 0; contador < i; contador++) {
String dato = datos.get(contador);
Uri imgUri = Uri.parse(dato);
LinearLayout.LayoutParams lparams4 = new LinearLayout.LayoutParams(
500, 250, 1f);
ImgVector[contador] = new ImageView(getActivity());
ImgVector[contador].setLayoutParams(lparams4);
ImgVector[contador].setImageResource(R.drawable.fotoandroid);
ImgVector[contador].setId(contador);
ImgVector[contador].setPadding(0, 10, 0, 10);
lyn.addView(ImgVector[contador]);
// personas++;
ImgVector[contador].setImageURI(imgUri);
}
}
我收到 NullPointerException:
04-25 08:39:57.630: E/AndroidRuntime(3358): FATAL EXCEPTION: main
04-25 08:39:57.630: E/AndroidRuntime(3358): java.lang.NullPointerException
04-25 08:39:57.630: E/AndroidRuntime(3358): at android.view.ViewConfiguration.get(ViewConfiguration.java:276)
Eclipse 没有报告语法错误。我做错了什么?