java.io.FileNotFoundException: open failed: ENOENT (No such file or directory

here's the code :
public void putLinearLayout(double number)
{
LinearLayout Linear = (LinearLayout)findViewById(R.id.linearlayout2);
DataBase db = new DataBase(this);
String name;
String image = null;
int mButtonHeight = 70;//hauteur
int mButtonWidth = 120;//longueur
Button im = (Button)findViewById(R.id.button4);
Drawable d = Drawable.createFromPath("res/drawable/pizza.jpg");
im.setBackground(d);

for(int i=1;i<=number;i++)
{
LinearLayout L = new LinearLayout(this);//line 56
//L.setBackgroundColor(Color.WHITE);
LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT); //<--this line , is what you were missing
L.setLayoutParams(params); //<-- and then this

ImageButton b1= new ImageButton(this);
image = db.getImage(i);
b1.setImageURI(Uri.parse(image));
TextView tv = new TextView(this);
tv.setGravity(Gravity.CENTER);
tv.setTextColor(Color.BLUE);
name=db.getCategoryName(i);
tv.setText(name);
L.setOrientation(LinearLayout.VERTICAL);
b1.setMinimumWidth(mButtonWidth);
b1.setMinimumHeight(mButtonHeight);
L.addView(b1);
L.addView(tv);
Linear .addView(L);
}


 

Back  [1] [2] 

Copyright © 2007-2012 www.chuibin.com Chuibin Copyright