How to Download a Bitmap File in Android SDK

The "ImageView" control in the Android SDK lets you include and download a BMP file and include it in your Android app. Android includes a list of pre-packaged images, or you can use a custom bitmap image. The image must be included in your Android app directory, so it's included when you package and distribute the app.

Instructions

    • 1

      Open the Java Eclipse editor and open your Android app project. Open the Java source code file you want to use to include the BMP.

    • 2

      Double-click the main XML file to add the image resource to your resource map. Copy and paste the following code:

      <ImageView

        android:layout_width=&quot;wrap_content&quot;
      android:layout_height=&quot;wrap_content&quot;
      android:tint=&quot;#55ff0000&quot;
      android:src=&quot;@drawable/bmpimage&quot;/>

      Replace the "bmpimage" with the image name in your project.

    • 3

      Return to the Java source code file. The source code file is where you "call" the image and display it in the app. The following code displays the BMP in the Android app window:

      ImageView bmp = (ImageView) findViewById(R.id.bmpimage);

          Bitmap map = BitmapFactory.decodeFile(&quot;/bmpimage.bmp&quot;);
      bmp.setImageBitmap(map);
Related Searches

References

Related Ads

Check It Out

7 Tips for Photographing Your Kids on Halloween