JarExtraction


Source link: https://github.com/ankitdubey021/ExtractionLib

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);

  
}
 
}
 

Make sure, you've asked for permission at runtime to read the file as follows, otherwise you'll get exception as FileNotFoundException

@Override protected void onCreate(Bundle savedInstanceState) {

  super.onCreate(savedInstanceState);

  setContentView(R.layout.activity_main);

ActivityCompat.requestPermissions(MainActivity.this,  new String[]{
Manifest.permission.READ_EXTERNAL_STORAGE
}
,  1);
  
}
  @Override public void onRequestPermissionsResult(int requestCode,

 String permissions[], int[] grantResults) {

  switch (requestCode) {

case 1: {

 // If request is cancelled, the result arrays are empty.

 if (grantResults.length > 0

&& grantResults[0] == PackageManager.PERMISSION_GRANTED) {

 extract();

 
}
 else {

  Toast.makeText(MainActivity.this, "Permission denied to read your External storage", Toast.LENGTH_SHORT).show();

 
}

 return;

}

}

 for any query, you can mail me at -> [email protected] 
}
 

Resources

Library for GIF results, preview, play, share everything at one place!

Custom-Typeface is a library to add custom fonts in android. By using this library you can easily set custom font on TextView, EditText, Button, CheckBox, RadioButton and AutoCompleteTextView and other wedgets in android. You can set custom typeface easily in XML.

A simple to use library for animating shapes along a given path.

An Android library for working with last.fm API.

This library is created with the purpose to implement recyclerview with videos easily.

It is targeted at solving following problems:

  1. Flicker when scrolling.
  2. Lag or skipping frames when video starts.
  3. OutOfMemory errors.

And it has following features:

  1. Auto-play videos when in view.
  2. Auto-pause videos when not in view or partially in view.

A Horizontal picker library for android which supports both text and icons

Features:

  • Supports icons and text or a mixture of both as items of the picker.
  • Tap or scroll horizontally to select the items.
  • Supports drawables, selectors and text highlighting using selectors.
  • Selection change listener to monitor the current selected item.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes