Reputation: 65
this is a bit of a non-specific question where i need some guidance. As part of a project we did, i need to create an app that has information about a town - the best places to visit and their history etc. the content is all static with images. The 'interactive' functions users have is to filter sites of interest based on Historic, cultural etc. There will be about 50 such sites. An idea was to use the Master Page - such as we use in ASP.NET. But as a newcomer to android i do not know if there is such a thing as the master page in android. I read an article where they derive for each activity from a base activity, but in my case having 50 activities just sounds stupid. Can anyone suggest an approach? Store the text in strings? use separate text files?
Upvotes: 4
Views: 2270
Reputation: 6108
I will try to give you an overview of the app you are trying to create.
First, you would have an activity, say CategoryListActivity
, which list out all categories (i.e. Historical sites, Cultural sites, for example) using ListView
.
When the user clicks on Historical sites, it launches another activity called PlaceListActivity
. You pass an additional param to this activity using Intent
, telling it that you want to show places in historical sites only. It will show all available places that fits your criteria, using ListView
again.
Now when the user clicks on one of the places, it launches third activity called PlaceDetailsActivity
, which shows all information related to this place. It is up to you to determine how to show these information.
So you just need min. 3 activities in total (of course you will need a bit more). Regarding your data, storing all text inside SQLite database would be a great choice. You can assign each place and category with an id, so you can tell CategoryListActivity
and PlaceListActivity
to load data dynamically. The only hard-coded data, is when you trying to populate the database on first launch. However, you can always prepare the database first, pack it with your app, and ask your app to load and use it immediately.
Upvotes: 4
Reputation: 5825
I would store all the text in an embedded SQLite database, and all the media in the assets folder.
Upvotes: 2