Design question: Activity per screen or not

by David Melgar » Wed, 03 Feb 2010 05:23:31 GMT

Sponsored Links
 tt>Are there guidelines to help understand how fine grained to make  

I've heard people state that an activity should be just one screen and
that multi-screen applications should have one activity per screen.
But this model can seem awkward, more work, and I'm not sure what
value you get in return.

What are the pros and cons of many activites vs few.

I've also heard debate about how much processing can occur in an
activity and some people suggesting that any complex work should occur
in a service. That doesn't seem obvious to me. How is the browser
implemented? A bunch of activities and a service to do the real work,
or just one actiity to render a web page and that activity does all
the work?

Are there issues with threads that determines how you should design
you app, ie few or many activities and need for a service?


Sent from my iPhone

On Feb 2, 2010, at 9:43 AM,

Today's Topic Summary

[1 Update]

'drawable' vs. 'drawable-hdpi' in Online Tutorial [5 Updates]
list view button error [2 Updates]
Eclipse can't seem to locate [1 Update]
Bug in SDK Manager: cannot update [1 Update]
Not able to start Call Log Activity [1 Update]
SDK Setup.exe not working [1 Update]
No market on HTC hero [1 Update]
I have note pad where are notepads files saved??? [1 Update]
Can't create new class in Eclipse (Google Map View official
tutorial) [1 Update]

alagmy <> Feb 02 06:28AM -0800 ^

open all blocked sites now for free and have fun

Topic: 'drawable' vs. 'drawable-hdpi' in Online Tutorial
Indicator Veritatis <> Feb 01 12:17PM -0800 ^

It seems the online tutorials have not been rewritten to reflect
Android 2.1. For they still refer to 'drawable' and 'res/drawable',
but when I create a new project for 2.1 using the wizard, I do not GET
any such directory. Instead, I get 'res/drawable-hdpi', 'res/drawable-
ldpi' and 'res/drawable-mdpi'.

Now for some tutorials, I have been able to get by by putting files in
'res/drawable-hdpi'. But for the TabLayout tutorial,

this does not work. I still get the error message (on completion of
step 3) "R.drawable.ic_tab_artists cannot be resolved".

The files "ic_tab_artists_grey.png" and "ic_tab_artists_whit.png"
really are in res/drawable-hdpi.

I also tried changing the name 'drawable' to 'drawable-hdpi', but Java
did not like the '-' in the name (no surprise).

So how are we supposed to get this to work? Go back to 1.5? Surely
there is a better way.

Just for clarity's sake, the line of code I get the error on is: spec
= tabHost.newTabSpec("artists").setIndicator("Artists",
// res.getDrawable


Design question: Activity per screen or not

by Smelly Eddie » Wed, 03 Feb 2010 22:52:27 GMT

 avid - a few thoughts.

Each screen should be a new activity. The cost of creating a new
class is about 2 minutes and 4kb. The benefits are numerous.
1) Rely on xml layouts without custom if this screen than that or if
that screen then this
2) Avoid complex logic and bloated classes. In programming each class
should do one thing, and do it well. Android follwos this principle.
3) Navigationis handled by Android. Users can navigate back and forth
using the framework, so you don't need to code the "where am I" stuff.

A properly designed application with numerous tasks can be smaller
than a bloated activity serving many screens with unnecessary logic.
This means it also relioes on android optimized code for smoother

In regards to a service. They should be for something that is long
running, behind the scenes (like gathering twiiter updates every 10
minuites, or checking email servers). For most "complex" tasks within
an application you'll likely just use ASyncTask that will run the
logic in a background thread so the UI remains snappy.

There are more guidlines very well documentwed in the android devloper
site. UI Guidelines and Activity Flows should be researched.

On Feb 2, 3:44pm, David Melgar <> wrote:
> >

Sponsored Links

Other Threads


oxygen mantab koq, stabil dan cepat..
secara blm update, jd icip2 ROM lain,,,

"Indonesian Android Community [id-android]"

PING'S mobile
Email:  Ph. (021) 96087100
Yopie Ratjoen
Email:  Ph. 08977726681
Gila original
Email:  Ph. (031) 91555898

Aturan Jual/Kloteran ID-Android

2. Help.gagal app2sd

Malam para suhu2.

Ane newbie di android.baru pake hh SG5. dah di root pake universal
androot.iseng2 td nyoba skrip app2ss lewat kompi linux.ada kesalahan gara2
lupa backup ama nda tau klo app2sd nyimpen aplikasi di partisi fat toh.ane
kira di ext.jadi krn kurang space setelah reboot error lah
marketnya ilang je heheh. Gmn penyelesaiannya ya? Apa musti ke samsung
center ya


"Indonesian Android Community [id-android]"

PING'S mobile
Email:  Ph. (021) 96087100
Yopie Ratjoen
Email:  Ph. 08977726681
Gila original
Email:  Ph. (031) 91555898

Aturan Jual/Kloteran ID-Android

3. 3d mmo bwat android

4. AVD cursor

5. HH WinMo diganti ma Android?

6. Mohon testi boss yopie suryadi

7. Passing an ArrayList of Objects