Tuesday, February 8, 2011

[android-developers] Re: Help with strings/arrays

Here is a simple solution:

Add a method which takes the level number integer. Then, depending on the value of the level number, call the appropriate level function.
When level N is pressed, you call level(N)


class YourClassHavingLevelMethods
{
   public static void level(int x)
   {
      switch(x)
      {
          case 1:
             level1();
             break;
          case 2:
             level2();
             break;

             ///others as necessary...............

      }
   }

   public static level1()
   {
     ................
   }

   public static level2()
   {
     ................
   }


   ..................

   public static level9999999()
   {
     ................
   }


}


Regards
Sarwar Erfan

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment