Skip to content

Instantly share code, notes, and snippets.

View iniyanmurugavel's full-sized avatar
🎯
Focusing

Iniyan Murugavel iniyanmurugavel

🎯
Focusing
View GitHub Profile
@iniyanmurugavel
iniyanmurugavel / git ignore
Created May 16, 2020 12:12
Proguard rules gitignore
git ignore file
# Built application files
*.apk
*.aar
*.ap_
*.aab
# Files for the ART/Dalvik VM
*.dex
@iniyanmurugavel
iniyanmurugavel / uri to getPath()
Created May 16, 2020 12:15
Upload intent.getData() onActivity uri to path url function to get Path
package com.examp.three.common.fileupload;
import android.content.ContentUris;
import android.content.Context;
import android.database.Cursor;
import android.database.DatabaseUtils;
import android.net.Uri;
import android.os.Environment;
import android.provider.DocumentsContract;
import android.provider.MediaStore;
@iniyanmurugavel
iniyanmurugavel / uri to getPath()
Last active May 19, 2020 06:35
Upload intent.getData() onActivity uri to path url function to get Path
package com.examp.three.common.fileupload;
import android.content.ContentUris;
import android.content.Context;
import android.database.Cursor;
import android.database.DatabaseUtils;
import android.net.Uri;
import android.os.Environment;
import android.provider.DocumentsContract;
import android.provider.MediaStore;
@iniyanmurugavel
iniyanmurugavel / proguard minifying
Created May 16, 2020 12:16
Proguard rules for shrinking and R8
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
@iniyanmurugavel
iniyanmurugavel / git commands
Created May 16, 2020 12:20
Github commands
Commands Usages
git tag 1.1.2
git commit -a -m "msg"
git reset .travis.yml
git push origin tag 1.1.4"
// Git Tag Create
commit tag Push
@iniyanmurugavel
iniyanmurugavel / git commands
Last active May 28, 2020 13:52
Github commands
Commands Usages
git rm -r --cached . - remove local commits
git tag 1.1.2
git commit -a -m "msg"
git reset .travis.yml
git push origin tag 1.1.4"
// Git Tag Create
commit tag Push
@iniyanmurugavel
iniyanmurugavel / contacts
Created May 16, 2020 12:23
Please use this function to pass phone number and country code like india 91
public static String parseContact(String contact, String countrycode) {
PhoneNumber phoneNumber = null;
PhoneNumberUtil phoneNumberUtil = PhoneNumberUtil.getInstance();
String finalNumber = null;
String isoCode = phoneNumberUtil.getRegionCodeForCountryCode(Integer.parseInt(countrycode));
boolean isValid = false;
PhoneNumberType isMobile = null;
try {
phoneNumber = phoneNumberUtil.parse(contact, isoCode);
isValid = phoneNumberUtil.isValidNumber(phoneNumber);
@iniyanmurugavel
iniyanmurugavel / Android common issues
Last active May 17, 2020 13:55
Android common errors
Question 1 :
Fatal Exception: java.lang.OutOfMemoryError:
Failed to allocate a 115252268 byte allocation with 16777216 free bytes and 90MB until OOM
OOM - OutOfMemoryError in java
solutions :
You also can set a larger memory heap witting android:largeHeap="true"
(OOM) in Java is one problem which is more due to system's limitation (memory)
rather than due to programming mistakes in most cases though in certain cases you could have memory leak
which causing OutOfMemoryError.
public static boolean isIFSCCODEValid(String ifsccode)
{
///^[A-Za-z]{4}[0-9]{6,7}$/
String regExp = "^[A-Z]{4}[0][A-Z0-9]{6}$";
boolean isvalid = false;
if (ifsccode.length() > 0) {
isvalid = ifsccode.matches(regExp);
}
@iniyanmurugavel
iniyanmurugavel / Kt
Last active May 22, 2020 19:03
Important Questions
#Lazy Loading Design Pattern
Lazy loading is a concept where we delay the loading of object until the point where we need it.
Lazy loading is just a fancy name given to the process of initializing a class when it’s actually needed.
In simple words, Lazy loading is a software design pattern where the initialization of an object occurs only
when it is actually needed and not before to preserve simplicity of usage and improve performance.
Lazy loading is essential when the cost of object creation is very high and the use of the object is very rare.
So this is the scenario where it’s worth implementing lazy loading.
The fundamental idea of lazy loading is to load object/data when needed.