Skip to content

Instantly share code, notes, and snippets.

View abhishekgargx's full-sized avatar
🏠
Working from home

Abhishek Garg abhishekgargx

🏠
Working from home
View GitHub Profile
@abhishekgargx
abhishekgargx / FileManagerAndroid.java
Last active July 9, 2018 05:50
[Android] How to get files in android according to file types or using its extension from internal or external storage.
package com.your.package.name;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
@abhishekgargx
abhishekgargx / KeystoreAndroid.java
Last active July 9, 2018 05:48
[Android] How to use Keystore in Android, Easily use keystore using only two methods Encrypted and Decrypted , MIN API level 18
package com.your.package.name;
import android.content.Context;
import android.security.KeyPairGeneratorSpec;
import android.util.Base64;
import com.pint.app.preferences.InitManager;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.math.BigInteger;
import java.security.KeyPair;
@abhishekgargx
abhishekgargx / .bablerc
Last active January 15, 2019 09:51
React native package.json with redux, react , rnrf , axois and react-navigation. - works and tested for Android , latest react native version 0.55.4
{
"presets": ["react-native"]
}
@abhishekgargx
abhishekgargx / react-native-router-flux-android-back-button-fix.js
Last active January 28, 2019 10:32
React Native | react-native-router-flux | Redux | Android Back button listener ,handle back press on android while using react native.
// below code works with Android + react native + react-native-router-flux
// this is final index.js file code from where control whole app navigation
import { BackHandler, ToastAndroid } from 'react-native';
import React,{Component} from 'react';
import { Router, Scene, Actions } from 'react-native-router-flux';
import { Provider } from 'react-redux';
// as per your compoenents import them accordingly
import Home from './home';
import OtherScreen from './OtherScreen';
//variable
@abhishekgargx
abhishekgargx / AndroidManifest.xml
Last active October 22, 2020 08:43
Android Push Notification using Firebase Cloud Messaging ( FCM ) , works in Foreground , background , app killed, dead. includes Notification Actions - Abhishek Garg
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
@abhishekgargx
abhishekgargx / ScreenSizeHelpers.java
Created December 13, 2018 07:32
Android Mobile Screen Size Helper method
/*
* Copyright 2018 Abhishek Garg
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@abhishekgargx
abhishekgargx / BackgroundManager.java
Created December 13, 2018 07:43
Color Blender for android , blend colors like instagram background
/*
* Copyright 2018 Abhishek Garg
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@abhishekgargx
abhishekgargx / MyKeystore.java
Last active January 28, 2019 10:47
How to use Keystore in android for storing and getting sensitive data , minimum support sdk level 19.
package com.abhishek.softneed;
import android.content.Context;
import android.security.KeyPairGeneratorSpec;
import android.util.Base64;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.math.BigInteger;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
@abhishekgargx
abhishekgargx / babel.rc
Last active November 19, 2019 21:41
Using React native 55.4 build.gradle patch for Android . FIX for duplicate resources found error in react native release or signing app.
{
"presets": ["react-native"]
}
@abhishekgargx
abhishekgargx / RecycleViewWithWrapContent.txt
Created August 20, 2019 10:05
How to use Recycle view with wrap content as height.
> ### **there are two ways i found working well for me. To make recycle view height behave as wrap content **
### **First way**
> Putting recycler view inside in the Nested Scroll view to acheive wrap content functionality
```
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"