开发者

Android create favourites issue

开发者 https://www.devze.com 2023-04-04 14:18 出处:网络
Hi I need a little help with an issue that I have. I had to build an application which needs to show only a text information and pictures.The content was a lot, that\'s why instead of creating 200 si

Hi I need a little help with an issue that I have.

I had to build an application which needs to show only a text information and pictures.The content was a lot, that's why instead of creating 200 single activities for very page I create one base activity which content I'm changing everytime depends on which listview item is clicked using putExtra(); and getExtra();. So the problem now is that they want me to create Favourites page, where the users can save some of the information and access them on a single activity.Actually it's really easy to do this using sqlite,but they want from me to finish the application today, within a few hours.My problem is that If i start coding it again and insert all that information in database it will take much more time for me.

So here is a little more explanation :

1.I have base activity with a listview.

2.When user click on listview item I send the content using putExtra in base activity.

So I need to learn how to save the id of listview item or something else and show that content in new Activity. I was thinking of 开发者_JAVA百科using SharedPreferences but not really sure how to deal with that.

Any suggestions how I can do that...for a few hours. Thanks in advance!


What kind of content is it? Is it over 200 entries and you don't save them locally?

Just knowing if it's a favorite or not can not be more than one hour job using sqlite. Just keep the id of the content and then a value to see if it's a favorite or not.

Noone will really do that for you since it's obviously your (paid?) job. The fact that you can't do it in time is really not a reason to skip the best option to use. I would say don't be that optimistic about what you can achieve in which time. Manage your resources better and you will not have that problem.


You can achieve this with sharedpreferences too,but it's not a good idea. The best way is to do it with database,but it's up to you.

0

精彩评论

暂无评论...
验证码 换一张
取 消