ورود

View Full Version : مشکل در مقدار دهی textview در زمان اجرا در api level 7



gilas1368
یک شنبه 13 بهمن 1392, 09:19 صبح
سلام ب همه اساتید

من داخل برنامه امم 3 تا اکتیویتی دارم ک 3 تا لایه براش ست کردم

توی لایه سومم ک داخل اکتیویتی سوم باز میشه چندتا textview دارم ک میخام با کدنویسی بهشون مقدار بدم
اما زمانیک بهشون مقدار میدم خطای زیر رو بهم میده


02-02 09:57:06.628 943-950/? E/AndroidRuntime: ERROR: thread attach failed
02-02 09:57:10.048 949-949/? E/AndroidRuntime: Uncaught handler: thread main exiting due to uncaught exception
02-02 09:57:10.058 949-949/? E/AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{gilas.company.owner/gilas.company.owner.ShowInformation}: java.lang.NullPointerException

اینم کدایی ک باهشون textview ها رو مقدار میدم


private void ShowInformation(Cursor cursor){
if (cursor.getCount() > 0) {
TextView lblShowName = (TextView) findViewById(R.id.showName);
TextView lblShowFamily = (TextView) findViewById(R.id.showFamily);
TextView lblShowPhone = (TextView) findViewById(R.id.showPhone);
TextView lblShowPosition = (TextView) findViewById(R.id.showPosition);

ImageView showPicture = (ImageView) findViewById(R.id.showPic);

lblShowName.setText(cursor.getString(0));
lblShowFamily.setText(cursor.getString(1));
lblShowPhone.setText(cursor.getString(3));
lblShowPosition.setText(getIntent().getStringExtra ("position"));

showPicture.setImageBitmap(getBitmapFromAsset("i_1.jpg"));

callNumber = "0" + cursor.getString(3);
} else {
this.finish();
}
}

ممنون میشم راهنمائیم کنین تا متوجه بشم مشکلم از کجاست:متفکر:

راستی من دارم با api level 7 کار میکنم

rubiks.kde
یک شنبه 13 بهمن 1392, 10:13 صبح
خروجی logcat رو کامل بزارید.یه جا NullPointerException دارید