Posts

Showing posts from November, 2016

How to Reduce Android APK file size

There are several reasons you, as a developer, should be concerned about the size of your application and be actively trying to reduce APK size as much as possible. For one thing, there are potential users of your application who might be limited by their data plan, connectivity, or storage space on their phones. Offering an application with size of tens or hundreds of megabytes could potentially make them think twice before downloading your app and maybe even go for a different option just to save the bandwidth. First of all, let’s describe the APK file format and analyze what’s hides inside of it. APK file format APK (Android application package) is the package file format for distribution and installation of Android mobile apps. It contains all of the application’s code, resources, assets, manifest file and other application’s files. APK is a type of archive file, specifically it is based on the JAR and ZIP file formats. Application size When thinking of the APK size,

Android Activity, lifecycle, methods and states

Image
Activity : An activity is a single, focused thing that the user can do. Almost all activities interact with the user, so the Activity class takes care of creating a window for you in which you can place your UI with   setContentView(View) . While activities are often presented to the user as full-screen windows, they can also be used in other ways: as floating windows (via a theme with   windowIsFloating   set) or embedded inside of another activity (using   ActivityGroup ). Android activity is the subclass of ContextThemeWrapper class. There are two methods almost all subclasses of Activity will implement: ·          onCreate(Bundle)   is where you initialize your activity. Most importantly, here you will usually call   setContentView(int)   with a layout resource defining your UI, and using   findViewById(int)   to retrieve the widgets in that UI that you need to interact with programmatically. ·          onPause()   is where you deal with the user leaving your activity.