I need to develop an android app that achieves the following:
Create an activity which takes a picture on a button click.
Once the picture is taken, have two buttons save and compare.
The picture should be saved in a database if save button is clicked.
If compare button is clicked, the picture should be compared with all other pictures in the database.
If the picture matches with the one in the database, the name of the picture stored in the database should be displayed.
I know how to use the Camera API to take a picture. But I don't have an idea of how to save the same picture in a database and compare it with all other pictures in the database.
If my idea is wrong please correct me.
Thanks!
Everything you need is within these tutorials so check this link:
http://thenewboston.org/list.php?cat=6
The logic for comparing the pictures you will have to write yourself though because I can't predict what type of comparison you want. Except that how to connect to db to store data plus getting bitmap from the camera everything is in those tutorials.
Hope this helps!
Don't save the picture in your database. Instead save it on the SDcard/internal storage and save the url in your database. (Simpler approach)
As far as comparing with other pictures, you will need to implement some image recognition/pattern matching algos.
Related
I am creating an android app in which user can take a pic directly from camera or can choose it from gallery and can also put some text in Edittext box, like a form. Later the app will show all the feeded data in a Listview. Clicking on Listview item will open the detail page. Listview should display a thumbnail of the pic along with the text entered and detail page should display the whole pic with text.
I am very confused how to first save this data and which storage method would be efficient. Should I go for Sqlite or internal file storage? And then this whole thumbnail thing. If you can share any info, tutorial on how to do it would be appreciated :)
And forgive me, if this question is out of the box.
Regardless of the storage engine you use, you should store the following:
Image file URI
String of entered text
These two elements can be stored using any of these options:
"Pure" SQLite
An ORM that wraps SQLite, providing more flexible functionality (ActiveAndroid, for example).
A non-SQLite DB, such as Realm (realm.io)
Store a list in shared preferences
Depends on how much data you have, and on how confident you feel with DBs in general.
I follow this Instruction and it works.
Problem:
Every time I exit my application I need to capture again another image but the image that was been capture is save in the android gallery
Question:
How can I save the image in database so when I open my application the image will be their.
Unlike some comments suggest, image format doesn't matter. You can either save it as BLOB (byte[]) or text (converting it to Base64).
Anyway it's not a good idea to store images in a DB, prefer a file, as argued over here.
i will advice you get the path at which the image is located at in the android device and load up on your application start. the case of saving it in a database is not cool. that is like consuming the user's memory space on the database side and also the device storage which is not cool.
I'm building an app that retrieves image of the day from Nasa website.
It basically has 3 TextViews to display title, date and description of the app and an ImageView to display bitmap image from website. And the app works fine.
But I want to add the ability to view these data even when the app is offline and to show previous image along with 3 TextViews onSwipe or onClick...
Can anybody please help me with this?
I've tried searching on how save and retrieve strings but couldn't figure it out.
Have a look at SharedPreferences or if you plan to store more data try a SQLite database. Here is the tutorial to store files in Android.
Nothing is better than Official Docs
[http://developer.android.com/training/basics/data-storage/index.html][1]
1.i have written code to take an image by android phone
2. i got current location of the user
Now i want to save this image in sqlite db along with current gps location So that one could view image in Map with its tagged details.
Please help. I am very new to android.
This link can be used for storing the image as a blob file and retrieving it.
My advice would be like instead of saving the image to sqliteDB, better just save the path of the image. Directly saving in the sqliteDB will result in increase in the application memory usage. This way you can depend on SD card.
Hope that helps :)
I am writing an app that uses the camera intent to take a picture. I get the uri of the image (which is saved in the gallery) and can display the image in the ImageView. I am trying to figure out the best way to save this uri in the SQLite database in order to retrieve it later and put the image in the ImageView. Do I use a BLOB to store the uri? If so, how would I do this? Or do I convert the uri to a String and store it that way? I've been searching for an answer and I must be using the wrong search words, because I can't find an answer to what should be a simple question.
It would depend on how you want to access it later. For what your're considering there are two options, since the image is already saved on you phone, there is no need to save it twice as a blob. Or if you will move the image on the phone or remove it, having it in a blob would be better.
In reality, you'd be better service saving the image in a directory set aside just for images from your app and then reading all the file names in that directory later for access.