1. Download our Official Android App: Forums for Android!

Apps Error empty height width

Discussion in 'Android Development' started by pietjuhhh1990, Mar 31, 2011.

  1. pietjuhhh1990

    pietjuhhh1990 Well-Known Member
    Thread Starter
    Rank:
    None
    Points:
    38
    Posts:
    235
    Joined:
    Feb 21, 2011

    Feb 21, 2011
    235
    22
    38
    App/web development
    Netherlands
    I want an generated bitmap to show in an imageview.

    values of vars
    cameraWidth = 360
    cameraHeight = 480
    rgb = int[] for color codes

    al vars ar confirmed.

    this is the code
    Code (Text):
    1.  
    2. public void runBitmap(int cameraWidth, int cameraHeight){
    3.         Bitmap bmp = Bitmap.createBitmap(rgb, cameraHeight, cameraWidth, Bitmap.Config.RGB_565);
    4.         ImageView mBitmapPreview = ((ImageView) findViewById(R.id.imageView1));
    5.         try {        
    6.             mBitmapPreview.setImageBitmap(bmp);
    7.         } catch (Exception e){
    8.             e.printStackTrace();
    9.         }
    10.     }
    11.  
    I included an image where you can see the value of heigt an width is -1.
    How can i fix this?

    [​IMG]
    [​IMG]
     

    Advertisement

Share This Page

Loading...