Quantcast
Channel: niravmehtablog
Viewing all articles
Browse latest Browse all 10

Save Image into SD Card in Android

$
0
0

For Beginner, today we learn how to save image on sdcard,

n this tutorial, you will learn how to save an image into your internal device SD Card. By default, images are usually stored to an internal device SD Card. We will create an actionbar menu and on menu item click will create a folder and save an image into the internal device SD Card. So lets begin…

Create a new project in Eclipse File > New > Android Application Project. Fill in the details and name your project SaveImageTutorial.

Application Name : SaveImageTutorial

Project Name : SaveImageTutorial

Package Name : com.androidbegin.saveimagetutorial

Open your MainActivity.java and paste the following code.

MainActivity.java

We have created an ImageView to show the attached image on the graphical layout and an actionbar menu. On actionbar menu item click will save the specified image into the internal SD Card.

We have prepared a sample image for this tutorial. Insert your downloaded sample image into your res > drawable-hdpi.

Next, create an XML file for your MainActivity Graphical Layout. Go to res > layout > Right Click on layout > New >Android XML File

Name your new XML file activity_main.xml and paste the following code.

activity_main.xml

Next, change the application name. Open your strings.xml in your res > values folder and paste the following code.

strings.xml

In your AndroidManifest.xml, we need to declare a permission to allow the application to write an external storage. Open your AndroidManifest.xml and paste the following code.

AndroidManifest.xml


Viewing all articles
Browse latest Browse all 10

Trending Articles