Skip to content

Instantly share code, notes, and snippets.

View nguyenlinhnttu's full-sized avatar
🎯
Focusing

Nguyen Linh nguyenlinhnttu

🎯
Focusing
View GitHub Profile
@ptkdev
ptkdev / android-restore-password-keystore-jks.md
Last active March 28, 2023 15:51
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

@sofakingforever
sofakingforever / AnimatedStarsView.kt
Last active February 3, 2022 09:21
Draw animated stars on Android view canvas - written in Kotlin - crafted with ❤️ by sofakingforever
package com.sofaking.moonworshipper.view
import android.content.Context
import android.graphics.Canvas
import android.graphics.Paint
import android.graphics.RectF
import android.util.AttributeSet
import android.view.View
import java.util.*
import java.util.concurrent.Executors
@nguyenlinhnttu
nguyenlinhnttu / 19: Thư viện Glide
Last active August 10, 2022 08:25
Tổng hợp các đoạn code hữu ích cho lập trình android - Chia sẻ code hay để dễ dàng tìm kiếm khi cần sử dụng. Xem thêm : https://goo.gl/agdWhl
Tiếng việt: https://goo.gl/vKRQQn
Tiếng Anh: https://goo.gl/8qsB7s
@ssinss
ssinss / EndlessRecyclerOnScrollListener.java
Last active January 19, 2024 08:52
Endless RecyclerView OnScrollListener
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener {
public static String TAG = EndlessRecyclerOnScrollListener.class.getSimpleName();
private int previousTotal = 0; // The total number of items in the dataset after the last load
private boolean loading = true; // True if we are still waiting for the last set of data to load.
private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more.
int firstVisibleItem, visibleItemCount, totalItemCount;
@Joev-
Joev- / DialogFragmentCallback.md
Last active June 25, 2021 08:43
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.

@madan712
madan712 / PingIP.java
Last active December 19, 2023 06:57
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(