Date Archives July 20, 2016

Break & Continue

break

  • Totally exit from loop(for,while,do~while) or from switch.

Example…

publc class example{
   public static void main(String[] args){
      int count = 1;
      while(true){
         if(count>3){ 
            break;
         }

         System.out.println(Integer.toString(count)+"th String printed lol");
         count++;
      }
   }
}

Output…

1th String Printed lol
2th String Printed lol
3th String Printed lol

continue

  • exit only current turn from loop(for,while,do~while), move onto next step in the loop.
publc class example{
   public static void main(String[] args){
      int count = 1;
      while(true){
         if(count%2==0){ 
            continue;
         }

         System.out.println(Integer.toString(count)+"th String printed lol");
         count++;
      }
   }
}

Output…

1th String Printed lol
3th String Printed lol
5th String Printed lol
...

Multidex for 64K limit problem

about

  • Android app originally designed with limit of 64K methods.
  • As app became bigger, android developer supported multidex for this problem.
  • So to use a lot of methods, you need to use Multidex in the code.

how to

Gradle configuration

android{
   ...
   defaultConfig{
      ...
      multiDexEnabled true
      ...
   }
   ...
}

Dependencies configuration in Gradle

dependencies{
   ...
   compile 'com.android.support:multidex:1.0.0'
   ...
}

AndroidManifest.xml   file Configuration

<application
   android:name="android.support.multidex.MultiDexApplication"
   ...>
   ...
</application>