JarExtraction

Additional

Language
Java
Version
2.0 (Nov 2, 2017)
Created
Nov 2, 2017
Updated
Nov 21, 2017
Owner
Ankit Dubey (ankitdubey021)
Contributors
Ankit Dubey (ankitdubey021)
ankit4code
2
Activity
Badge
Generate
Download
Source code
APK file

Blurb

ExtractionLib

Sometimes we need a lot of files to be downloaded from a server,we can download all of them in the form of jar and then extract your jar file which may carry images, excel files, etc, you don't have need to worry anymore, a lot of code is already there in library. Just you have to configure a little code in your android activity.

+First add ExtractionLib in your app level build file as follows 
  dependencies {
         compile 'com.github.ankitdubey021:ExtractionLib:2.0'
 }


-In project level build file, add the jitpack repository

  allprojects {
  repositories {
   ...
   maven { url 'https://jitpack.io' }
  }
 }

Now in your activity, call the Extract class method with following prototype

public class Extract extends ActivityCompat{

public static void extract(File jarfile, String path)throws Exception{ --- }

}

  +Jar file represents the file to be extracted, and path represents where to be extracted

Sample code

void extract(){
    try {
        File outputFile = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS), "value1.jar");
        Extract.extract(outputFile, new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS), "extration").toString());

        Toast.makeText(MainActivity.this, "Extracted!", Toast.LENGTH_SHORT).show();
    }catch(Exception e){
        System.out.println(e);
    }
}