创建具有静态内容Android应用 [英] Creating an android app with static content

查看:107
本文介绍了创建具有静态内容Android应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个有点非特异性的问题,我需要一些指导。
作为项目我们做的一部分,我需要创建一个拥有约镇信息的应用程序 - 最好的地方参观,他们的历史等内容全部用静态的图像。在互动功能的用户拥有的是基于历史,文化等将有大约50这样的网站来筛选感兴趣的地点。一个想法是利用母版页 - 比如我们在ASP.NET中使用。但作为一个新人到Android我不知道是否有这样的事情在Android上的母版页。我看了他们从基地活动的每个活动中获得的文章,但有50个活动,我的情况只是听起来很愚蠢。
任何人都可以提出一个方法呢?存放在字符串文本?使用单独的文本文件?

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?

推荐答案

我会尽量给你,你要创建应用程序的概述。

I will try to give you an overview of the app you are trying to create.

首先,你将有一个活动,说 CategoryListActivity ,其中列出所有类别(如历史遗址,文化遗址,例如)使用的ListView

First, you would have an activity, say CategoryListActivity, which list out all categories (i.e. Historical sites, Cultural sites, for example) using ListView.

当用户点击历史遗址,它会启动叫做另一个活动 PlaceListActivity 。您可以使用传递一个额外的参数,以本次活动意图,告诉它要显示只有历史遗迹的地方。它会显示适合你的标准,使用所有可用的地方的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.

现在,当上了地方之一的用户点击,它启动第三个活动叫 PlaceDetailsActivity ,这表明有关这个地方的所有信息。它是由你来决定如何显示这些信息。

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.

所以,你只需要分钟。 3活动总的(当然,你需要多一点)。关于你的数据存储SQLite数据库中的所有文本将是一个不错的选择。您可以指定每个地方和类别一个ID,这样你就可以告诉 CategoryListActivity PlaceListActivity 动态加载数据。唯一的硬codeD数据,是当你试图填充第一次启动数据库。但是,你可以随时prepare数据库首先,​​用你的应用程序包装好,并要求您的应用程序加载,并立即使用它。

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.

这篇关于创建具有静态内容Android应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆