473,396 Members | 1,968 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to save clicked image in a custom folder of the app?

I want the image clicked by the camera to be saved in my custom folder "MyCameraApp" and that image to be displayed in the app's listview.

Below is the TakePhoto() code:
Expand|Select|Wrap|Line Numbers
  1.  
  2.     /**
  3.      * take a photo
  4.      */
  5.     private void activeTakePhoto() {
  6.         Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
  7.         if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
  8.             String fileName = "temp.jpg";
  9.             ContentValues values = new ContentValues();
  10.             values.put(MediaStore.Images.Media.TITLE, fileName);
  11.             mCapturedImageURI = getContentResolver()
  12.                     .insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
  13.                             values);
  14.             takePictureIntent
  15.                     .putExtra(MediaStore.EXTRA_OUTPUT, mCapturedImageURI);
  16.             startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);
  17.         }
  18.     }
  19. The TakePhoto() function calls REQUEST_IMAGE_CAPTURE:
  20.  
  21.     case REQUEST_IMAGE_CAPTURE:
  22.                 if (requestCode == REQUEST_IMAGE_CAPTURE &&
  23.                         resultCode == RESULT_OK) {
  24.                     String[] projection =    {      MediaStore.Images.Media.DATA};
  25.                     Cursor cursor =
  26.                             managedQuery(mCapturedImageURI, projection, null,
  27.                                     null, null);
  28.                     int column_index_data = cursor.getColumnIndexOrThrow(
  29.                             MediaStore.Images.Media.DATA);
  30.                     cursor.moveToFirst();
  31.                     String picturePath = cursor.getString(column_index_data);
  32.                     MyImage image = new MyImage();
  33.                     image.setTitle("Test");
  34.                     image.setDescription(
  35.                             "test take a photo and add it to list view");
  36.                     image.setDatetime(System.currentTimeMillis());
  37.                     image.setPath(picturePath);
  38.                     images.add(image);
  39.                     daOdb.addImage(image);
  40.                     imageAdapter.notifyDataSetChanged();
  41.                     listView.invalidateViews();
  42.                 }
  43.         }
Dec 6 '15 #1
0 1030

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: thomaz | last post by:
I would like to know the correct way to save an image showing in a Picture Box???? Thanks....
1
by: news.austin.rr.com | last post by:
hi im using the following code below to gain access to a browser control document. mshtml.IHTMLDocument2 doc = axWebBrowser1.Document as mshtml.IHTMLDocument2; can i use the "doc" object...
1
by: Jet Jaguar | last post by:
I'm trying to find a way to set a custom folder icon in OS X. I thought that Applescript would be able to do it, but apparently it can't. Is there anything in the Macintosh libraries of Python...
0
by: Phil Galey | last post by:
I created a desktop application in VB.NET and in the Setup and Deployment project, under File System on Target Machine, I added a custom folder which is to be added to the Desktop of All Users. To...
0
by: zeid | last post by:
I have an install project that sets up a custom folder to install an addin to another 3rd party program. The location of the 3rd party program can be found in the registry but I need to be able to...
1
by: Smita Kashyap | last post by:
Hello to all, Which one is flexible/optimal solution to save uplaoded image. Frist save image at server or from where you're site pages are save in any image folder and save only image name or...
4
by: =?iso-8859-1?B?RulybmFz?= | last post by:
Hello all, How can I save a image that is on internet (eg: http://www.agalera.com.br/_img/layout/logo.gif)??? I would like to save the image on my server... many thanks
0
by: ramya naidu | last post by:
Hai friends i have cod eto draw and save picture in textbox and i need to save that image so iam using this code when i save the image and reopen it is not saving plz any one help me i have written...
0
nev
by: nev | last post by:
I have created custom folders and I wanna move some of my subscriptions to that folder. But everytime I try to check the particular subscriptions and select "move to folder..." then click GO, the...
6
by: jeddiki | last post by:
Hi, I am using snapcasa.com to provide me with an image. They encourage you to cache the images on your own server so I am trying to do that. When I use this code to display the image it...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.