ValentinH
ValentinH

Reputation: 958

Architecture advice for multi-screens app

I'd like to get some advice about architecture choices to develop an Android app displaying several screens.

The goal of the app is to present an assisted form input in a graphical way. The app will be used on tablets.

For example, there will have a first screen to welcome the user and asking to start filling the form. Then, another screen will be displayed to enter the date in an assisted way. Next, another screen for other informatio, and so on.

In total, there will have a dozen of screens and at the end, all the information will be sent on a server and the user will be able, at any time, to go back to the previous screen to edit his answer.

I have already practice the Android development but I have never had the opportunity to work on an actual project, especially with that many screens.

So my questions are:

Thanks by advance, Valentin

[EDIT] - Also I'd like to show an animation while changing screens

Upvotes: 2

Views: 233

Answers (2)

Siddharth
Siddharth

Reputation: 9584

To start with, ensure that you code with one screen one activity. That is the best way since Android optimizes activities, and not Views. Your back feature, future supportability all depend on good Android coding. Use your java syntax skills and patterns for non Activity (for that matter non android basic constructs intent, broadcast listener.....). But use Android's basic rules and constructs to take advantage of all optimizations and features and customer behavior habits.

When associating drawables, keep the following in mind.

  • The more drawable folders you have the more of a nightmare of maintenance you will have. Just keep 2 drawable and drawable-hdpi.
  • If you load from a device of mdpi, android resizes the drawables using bitmaps and a lot of memory. If you fall in this trap of OOM, just copy all drawable files to ldpi, mdpi. And copy all hpdi to xhpdi folders. This will avoid any Android auto resizing
  • Use SharedPreferences instead of sqlite when ever possible.

That was the long answer. The short answer is, stick to android basics, and keep it simple.

Edit :

Animations when you change screens is really easy in Android. For example you want to change the animation when you scroll back activities, you need to use overridePendingTransition, with 2 parameters, 1 for animation of current screen, and 2 for the animation of new screen. So the current screen may move to the right from 0 x, to 100 x, and new screen will move from -100 x to 0 x. Use the same delay to give it a pull feel. Hope this answers the question. For any more questions, please create a new question. Thanks.

@Override
public void onBackPressed() {
    finish();
    //go back to the previous Activity
    overridePendingTransition(R.anim.comming_in, R.anim.comming_out);   
}

Upvotes: 1

Androiderson
Androiderson

Reputation: 17083

I'd use Fragments, and swipe between screens

Have a look at Effective Navigation

Upvotes: 0

Related Questions