CategoryAndroid

Butter Knife

B

Butterknife is a light weight library to inject views into Android components. It uses annotation processing. The @BindView annotation allow to inject views and performs the cast to the correct type for you. The @@OnClick(R.id.yourid) annotation allows to add OnClickListener to a view. You can optional define the method parameter of the view in case you want it injected. Butterknife includes also...

Convert String to PrivateKey

C

Below code works to convert string to PrivateKey public static class DecryptionUtil { private static final String ASYMMETRIC_ALGO = "RSA/ECB/PKCS1Padding"; public static byte[] decryptUsingPrivateKey(PrivateKey privateKey, byte[] data) throws IOException, GeneralSecurityException { Cipher pkCipher = Cipher.getInstance(ASYMMETRIC_ALGO); pkCipher.init(Cipher.DECRYPT_MODE, privateKey); return...

Virtual Assistant

V

A virtual assistant is a software agent that can perform tasks or services for an individual. Sometimes the term “chatbot” is used to refer to virtual assistants generally or specifically those accessed by online chat (or in some cases online chat programs that are for entertainment and not useful purposes). As of 2017, the capabilities and usage of virtual assistants is expanding rapidly...

Use Glide Cache efficiently in Glide Android

U

The issue is that currently if I call Glide.load() multiple times with the same URL. however, each time with an image views the image gets downloaded again. It happens because the width and height are mixed into the cache key so if you load the same image into multiple different views with different sizes, the image will be fetched once per image by default. You can change this by calling  ...

Moshi – Modern JSON library for Android

M

Moshi is a modern JSON library for Android and Java. It makes it easy to parse JSON into Java objects: Download  the jar or dependancy via Maven: <dependency> <groupId>com.squareup.moshi</groupId> <artifactId>moshi</artifactId> <version>1.5.0</version> </dependency> or Gradle: compile 'com.squareup.moshi:moshi:1.5.0' String json = ...; Moshi moshi =...

Firebase JobDispatcher

F

The Firebase JobDispatcher is a library for scheduling background jobs in your Android app. It provides a JobScheduler-compatible API that works on all recent versions of Android (API level 9+) that have Google Play services installed. Overview What’s a JobScheduler? The JobScheduler is an Android system service available on API levels 21 (Lollipop)+. It provides an API for scheduling units...

Google Calendar – Calendar API

G

Step 1: Acquire a SHA1 fingerprint Step 2: Turn on the Google Calendar API Step 3: Create a new Android project Step 4: Prepare the project Open the app build.gradle file and add dependencies  content with the following: compile('com.google.api-client:google-api-client-android:1.23.0') {         exclude group: 'org.apache.httpcomponents'     }     compile('com.google.apis:google-api-services...

Uploading image to Google Drive from Android

U

Below code will help to upload image directly to your google drive private void saveFileToDrive() { final Bitmap image = mBitmapToSave; Drive.DriveApi.newDriveContents(getGoogleApiClient()) .setResultCallback(new ResultCallback<DriveApi.DriveContentsResult>() { @Override public void onResult(DriveApi.DriveContentsResult result) { if (!result.getStatus().isSuccess()) { Log.i("ERROR", "Failed...

Maintain cookie session in Android(Retrofit)

M

A session is a sequence of requests made by a single end-user during a visit to a particular site. A session or query session may be all queries made by a user in a particular time period or it may also be a series of queries or navigation with a consistent underlying user need. In Android, if we use the retrofit for web services call it internally uses OkHttp and OkHttp does not keep the track...

Category