Violin Nz
Violin Nz

Reputation: 327

Buttons "Back, Next and Exit" for Series of Activities

I want to create an app with this series of activities, the layout and animations are different in each activity.

enter image description here

What is the code for the back, next and exit buttons? I've been using OnClick Method, it's working fine, but the app SOMETIMES crashes if I click the next button too quick.

public void Next(View v){
  Intent next = new Intent(this, NextClass);
  startActivity(next);
  finish();

Is there a better way to do this? Change between activities?

(I'll appreciate if your answer could be "for dummies", I'm new to Android)

Upvotes: 0

Views: 137

Answers (1)

user3060611
user3060611

Reputation:

Is there a better way to do this? Change between activities?

Yes, there is the better way. Google co. also find out about this restrict when using many Activities.

So they support Fragment concept

You can use

ActionBarSherlock

combine with :

ViewPagerIndicator

from GitHub for using Fragment better.

Therefore you can avoid above case :

I've been using OnClick Method, it's working fine, but the app SOMETIMES crashes if I click the next button too quick.

p/s :

Fragments decompose application functionality and UI into reusable modules

Add multiple fragments to a screen to avoid switching activities

Fragments have their own lifecycle, state, and back stack

Fragments require API Level 11 or greater

Upvotes: 2

Related Questions