Saturday, February 22, 2014

How to Load Pictures on an Android Emulator



1. Click the Windows 'Start' button and type 'eclipse.exe.' Press 'Enter' to search the Eclipse executable. Double-click 'Eclipse.exe' to open the programming software.

2. Open your Android app project and double-click the XML file that defines the screen layout. Eclipse has a graphical designer, so you can click 'Designer' to view an emulator you use to drag and drop app elements such as an image.

3. Drag and drop an 'ImageView' element. The element displays in the emulator, but no image is defined.

4. Double-click the Java code file associated with the XML screen. Add the following code to add the image to the view:ImageView1.setImageResource(R.drawable.my_image);Replace 'my_image' with an image name located in the 'res/drawable/' section of the Eclipse project.

5. Click 'Save,' and then click the green 'Run' button to view the new image in the Android SDK emulator.

No comments:

Post a Comment