我正在尝试制作广告投放应用。我已经使listview从数据库中膨胀了它,我想在其点击上膨胀布局。但是布局没有得到任何数据。
Listview代码:
public class List1 extends Activity{
ImageView img1;
TextView txt,price1;
SQLiteDatabase sqLiteDatabase;
UserDbHelper userDbHelper;
byte[] photo;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list1);
userDbHelper = new UserDbHelper(getApplicationContext());
sqLiteDatabase = userDbHelper.getReadableDatabase();
price1=(TextView)findViewById(R.id.Price);
TextView des=(TextView)findViewById(R.id.des);
ImageView img1=(ImageView)findViewById(R.id.image2);
Intent in=getIntent();
int intValue = in.getIntExtra("id",0);
String i=Integer.toString(intValue);
Cursor cursor=userDbHelper.getContact(i,sqLiteDatabase);
if(cursor.moveToFirst())
{
String NAME=cursor.getString(0);
String PHONE=cursor.getString(1);
String PRICE=cursor.getString(2);
String DESC=cursor.getString(3);
byte[] PHOTO=cursor.getBlob(4);
Bitmap bmp = BitmapFactory.decodeByteArray(photo, 0, photo.length);
img1.setImageBitmap(bmp);
price1.setText(PRICE);
des.setText(DESC);
}
}
}
This is listview
This is showing after listview item click and i want it to be inflated with the data of list item which is clicked