I am developing an androod application where i want to make a fucntion like facebook post, where we can upload n number of images, so I want to make data base table, and i want to know the logic, so that a user with his email address he can upload n number of images to dat base table. Like a user can upload 1,2,3 etc images to data base table but I don't know how to accomplish this.
Asked
Active
Viewed 19 times
0
-
If you want to know how to store a data in database or image here's a solution http://stackoverflow.com/questions/9357668/how-to-store-image-in-sqlite-database otherwise try to explain your issue better – Moien.Dev Jan 29 '17 at 07:05
1 Answers
1
You can simply save the image in the sd card and save image path in database table column. If you are not familiar with SQLite Database before then please go through this post
https://www.tutorialspoint.com/android/android_sqlite_database.htm
Create table like this
Table-> Fb Post:
column -> email | imagePath
a@gmail | sdcard/path/1
a@gmail | sdcard/path/2
b@gmail | sdcard/path/5

Ajay Shrestha
- 2,433
- 1
- 21
- 25
-
Actually i am asking , is that you can see that in facebook post, we can select many n of images, and it is stored in data base , like in one row of database table we have many pictures for one email-id, I can do that like one image store for specific email id, but i need to store many images for one id in one table – Pir Fahim Shah Jan 29 '17 at 07:35
-
@PirFahimShah You wouldn't store 1...n images in 1 row. You would create a table that allows multiple images to be associated with an email, 1 per row. Then you'd use the email (or more likely a user id number) as a foreign key. I suggest you look into foreign keys and database schema design. – Gabe Sechan Jan 29 '17 at 07:38
-
@PirFahimShah GabeSechan is right. You can create table like this Table Post: email | imagePath a.gmail | sdcard/path/1 a.gmail | sdcard/path/2 b.gmail | sdcard/path/5 – Ajay Shrestha Jan 29 '17 at 07:39
-
@GabeSechan You mean I should create 2 tables. and in 2nd table i should put the primary key of first table in 2nd table as foreign key. So a sinlge user when upload multiple images, then in 2nd Table we would have multiple columns right for a single post.? – Pir Fahim Shah Jan 29 '17 at 09:29