Using java Syntax Highlighting
- public class bitmaptest extends Activity {
- /** Called when the activity is first created. */
- @Override
- public void onCreate(Bundle icicle) {
- super.onCreate(icicle);
- AbsoluteLayout absLayout = new AbsoluteLayout(this);
- Bitmap bitMap = BitmapFactory.decode("/res/drawable/google_logo_plain.png");
- BitmapDrawable bmd = new BitmapDrawable(bitMap);
- ImageView imageView = new ImageView(this);
- imageView.setBackground(bmd);
- //imageView.setImageResource(R.drawable.google_logo_plain);
- imageView.setScaleType(ScaleType.CENTER);
- absLayout.addView(imageView,
- new AbsoluteLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT, 0, 0)
- );
- setContentView(absLayout);
- }
- }
Parsed in 0.033 seconds, using GeSHi 1.0.8.4
when i run this code, it displays a blank sceen
but if i try with
Using java Syntax Highlighting
- imageView.setImageResource(R.drawable.google_logo_plain);
Parsed in 0.030 seconds, using GeSHi 1.0.8.4
the image will be displayed
what im doing wrong?
mauri

