开发者

Design Clarification in Android. List Activity vs Activity

I have a simple question. I am trying to design a simple Android app, which based on keywords searches something and shows a listing view of results. Currently it merely searches SMSes in the cellphone.

Here are some of the things I am faced with:

  • I have a simple first page with a textbox and a submit button. It's rendered by "Activity" inherited class call SMSFinder.

  • Once I have the results present with me, I want them to be binded to a list view. Showing preview text to limited characters, say 20 chars. Clicking on the same should "ideally" open the inbox (or outbox or whatever) and open the SMS, however that meant I cannot come back to my app easily. So I would rather open the whole SMS in my own app. So clicking on the app should open the SMS in a new screen with complete message, sender info etc. Few questions here,

If I wanted to can I actually open a SMS directly in inbo开发者_JAVA百科x? How? (Any code snippets will be wonderful)

Assuming I wanted to bind this result list with an ListActivity; can Activity and ListActivity co-exist in same app? How? In anycase, what is the best way to design this kind of UI stuff in android. I am a rookie so I am not sure, how it goes.

For generic Android phone apps, what are the best practices to make UI as compliant to as many phones? Like what kind of views should I use?

Any help will be much appreciated.


You can have more then one activity in your app. Think of an Activity as a Screen. That means you are using the first pure Activity for the startscreen. Then based on the user interactions you start another activity. If that is only a list that should be a listview, because it handles some nice things for you (Displaying a special textview if the list is empty, easy finding of the used list etc.)

Now you need an OnItemClickListener to react on user interactions with the list. Now you can start a third activity displaying the SMS details. This would be a normal activity again.

In this way you have three activities coexisting in your app and you have the three screens nicely separated in you code.

Don't forget to register all the activities in your manifest.xml to be able to start them.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜