Android save user profile image

Asked

Viewed 980 times

3

I am with a question what is the best method to save the profile image of the user of the app I am developing, where on the login screen will load the image of the user profile and home screen as well. From the research I’ve done, there are two ways:

1) Save the image in the database.

2nd) Save the image in an internal folder of the app and in the database save the path of that image.

One knows which is the best way or is that it consumes less processing resources. And in case you save in an internal folder how can I do this.

1 answer

2


Neither of the two ways will cause processing problems. You are working with data reading. This is orders of magnitude slower than anything the processor might be doing. Processor is the least of your problems.

Since we are talking about a binary file, it makes more sense for me to save in your application folder. Assuming that your application only allows one login at a time, you don’t even need to save the photo path in a database-- a fixed path solves this (think of it as /dadosdamiapplication/profile.jpg).

As for how to do that, I think you have a pretty complete answer here: /a/48228/26404

For any unanswered questions there or in another question, feel free to open a new one.

  • Pablo, thanks for the reply and I agree with you that it would be better to save in a folder, but as I forgot to mention in the question the app that will only allow to have a user per device it will have a desktop version where the user will be able to have their user on android and PC. In this case as I would do for this photo to be saved on the server for the desktop app to download this image?

  • I don’t know if this is a bad idea, but in this case if I made a class with the methods responsible for synchronizing the changes with the cloud server. So for example I would make a table in the database that would store all the changes that the user has made and in the background the app would check if it is authenticated with the server, if so it would check if the table has a record if it had it executed the synchronization class method according to the type of change recorded in the bank and then delete this record from the bank will be the best way or has a simpler way?

  • In this case I would have to make the app constantly access the server if there is any change it would synchronize, but how would I make it constantly access the server? , there may be a case where the user goes offline (no internet) and then comes back online.

  • Hello, @Gustavoalmeidacavalcante. Your doubts seem to escape the scope of this question. Comments here on Stack Overflow are for clarification, not for new questions. If you post your question in a new question, more people can be helped, since comments don’t go into the search.

  • Yes @Pablo vc this right these doubts escape the question of the post I will do another post for these questions and close this.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.