Go Back   Android Forums > Android Development > Application Development
Application Development Dev Lounge for the Coder Folks
Gamers - Check out our new sister sites!
Nintendo Wii U!    |    OUYA - $99 Android System!

test: Reply
 
LinkBack Thread Tools
Old September 20th, 2012, 12:19 PM   #1 (permalink)
Junior Member
Thread Author (OP)
 
Join Date: Nov 2011
Posts: 31
 
Device(s):
Carrier: Not Provided

Thanks: 1
Thanked 0 Times in 0 Posts
Default Stuck in global structure of my quiz app

Hi all, I recently started programming in Android, and as a beginning project I am trying to build a logo quiz app. The idea: You see a splash screen after opening the app (play game - about). Play game takes you to a new activity called LevelSelector.java where you can choose the level you want to play. Clicking on a level takes you to another new Activity Level.java.
I created a SQLite db with 20 questions in it which I install with a DBHelper.java class, every question also has a level column.

However, I get lost in my global structure. Since I work with different levels I don't want to make a new class for every level. I guess I have to make some kind of instance of a seperated class, or how can I solve this? I guess I lost the overview due to my lack of programming in android, but I figured the best way to learn it is (after I watched tutorials) to build an app myself..

Hope somebody can help me out!

B8787 is offline  
Reply With Quote
Sponsors
Old September 21st, 2012, 02:39 AM   #2 (permalink)
Junior Member
 
Join Date: Aug 2012
Location: Athens, Greece
Posts: 43
 
Device(s):
Carrier: Not Provided

Thanks: 6
Thanked 7 Times in 7 Posts
Default

At first Level isn't a good name for your third activity. I would have named it GameActivity. The GameActivity class will contain an instance of a Game class, which will wrap all information about the game. Level would be a field of this class. You could create an enum for the level:

Code:
public enum Level {
   EASY = 0,
   MEDIUM = 1,
   HARD = 2
}

public class Game {

  private Level level;

  public Game(Level level) {
     this.level = level;
  }

}
Kostas G is offline  
Reply With Quote
Reply


Go Back   Android Forums > Android Development > Application Development
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 09:12 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.