aspose file tools*
The moose likes Android and the fly likes Need logic to store an image Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "Need logic to store an image" Watch "Need logic to store an image" New topic
Author

Need logic to store an image

Anand Damodaran
Greenhorn

Joined: Oct 04, 2012
Posts: 21
Dear All,
In my project i want to capture an image.(i done this)
That captured image should be uploaded to the server(i will do it)
But the problem is- the image which has taken only uploaded to the server.

Now, how can i check this condition?

If the user replaced the original captured image with the same name then i cannot accomplish what i need to.

Please correct me, if i'm wrong.
1) storing the image in the internal memory
2) storing the image in the sqlite using blob
(in both cases after uploading ,the images should be deleted)

If i store the image in the sd card, is it possible to write protected the image ?

Thanks kindly,
Anand

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41874
    
  63
I don't think I understand the problem. If you don't want to overwrite an existing file, why are you allowing the user to do so? Your code can pick a unique name for it, no?


Ping & DNS - my free Android networking tools app
Anand Damodaran
Greenhorn

Joined: Oct 04, 2012
Posts: 21
Thanks Ulf,

Ulf Dittmer wrote:If you don't want to overwrite an existing file, why are you allowing the user to do so?


Yes, i should not keep the image in the sd card.

Just asking for my curiosity, is it possible to make the image write protected by using any classes in android api?

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41874
    
  63
There seems to be a disconnect between the question I asked, and the answer you gave, so I'm still not sure why you are allowing the user to overwrite the file. If you store it in Internal Storage, then no other app can get at it.
Anand Damodaran
Greenhorn

Joined: Oct 04, 2012
Posts: 21
Ulf Dittmer wrote:There seems to be a disconnect between the question I asked, and the answer you gave, so I'm still not sure why you are allowing the user to overwrite the file. If you store it in Internal Storage, then no other app can get at it.


Dear Ulf,

I tried to store the image in the internal memory. But,

This doesn't allows me to store the image in the internal memory.

please give any suggestions to store the image in internal memory or sqlite.

Also my camera activity crashes after clicking OK, why is it so?



Thanks kindly,
Anand


Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41874
    
  63
Even if that Intent does not store in Internal memory directly, you could move the file data to Internal memory afterwards.

Also my camera activity crashes after clicking OK, why is it so?

You need to TellTheDetails: Post the stack trace and the code that's causing the crash.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Need logic to store an image