Skip to content

Instantly share code, notes, and snippets.

View nguyenlinhnttu's full-sized avatar
🎯
Focusing

Nguyen Linh nguyenlinhnttu

🎯
Focusing
View GitHub Profile
@nguyenlinhnttu
nguyenlinhnttu / android-restore-password-keystore-jks.md
Created August 6, 2020 02:01 — forked from ptkdev/android-restore-password-keystore-jks.md
Android: Recovery lost keystore jks file or keystore password

Sign android app with new keystore file if you missing password or lost jks file.

  1. Create new keystore.jks file with comand line (not android studio build menu)

    Linux: keytool -genkeypair -alias upload -keyalg RSA -keysize 2048 -validity 9125 -keystore keystore.jks

    Windows: "C:\Program Files\Android\Android Studio\jre\bin\keytool.exe" -genkeypair -alias upload -keyalg RSA -keysize 2048 -validity 9125 -keystore "C:\keystore_new.jks"

  2. Generate a .pem file from new keystore

@nguyenlinhnttu
nguyenlinhnttu / PingIP.java
Created December 26, 2018 04:14 — forked from madan712/PingIP.java
Java program to ping an IP address
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class PingIP {
public static void runSystemCommand(String command) {
try {
Process p = Runtime.getRuntime().exec(command);
BufferedReader inputStream = new BufferedReader(
@nguyenlinhnttu
nguyenlinhnttu / ReadMe
Created May 29, 2018 03:07 — forked from pankaj89/ReadMe
Retrofit RxJava
Build Gradles
===============
//Retrofit
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile 'io.reactivex.rxjava2:rxjava:2.1.6'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
//Retrofit logs
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
package com.location;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentSender;
import android.location.Location;
@nguyenlinhnttu
nguyenlinhnttu / DialogFragmentCallback.md
Created January 25, 2018 08:59 — forked from Joev-/DialogFragmentCallback.md
Getting results from DialogFragment to calling Fragment using Callbacks

##Getting results from DialogFragments to another Fragment.

When setting up the DialogFragment make a call to Fragment.setTargetFragment()
Then from DialogFragment you can access the main fragment with Fragment.getTargetFragment()
Use interfaces to provide the required actions to the calling Fragment.

##Example code.

###AddFriendDialogFragment - Calls back to calling fragment.

import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.RectF;
import android.os.Build;
import android.text.Layout.Alignment;
import android.text.StaticLayout;
import android.text.TextPaint;
import android.text.method.TransformationMethod;
import android.util.AttributeSet;