Skip to content

Instantly share code, notes, and snippets.

View hasankucuk's full-sized avatar

Hasan Küçük hasankucuk

View GitHub Profile
@slightfoot
slightfoot / SearchActivity.java
Last active October 26, 2023 12:28
SearchView example
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Locale;
import android.content.Context;
import android.content.Intent;
import android.database.AbstractCursor;
import android.database.Cursor;
import android.support.v4.app.FragmentActivity;
import android.text.TextUtils;
@kristopherjohnson
kristopherjohnson / KeyboardUtil.java
Last active November 3, 2019 17:10
Methods to hide or show the soft keyboard in an Android activity
import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
/**
* Utility methods for manipulating the onscreen keyboard
*/
public class KeyboardUtil {
@sdogruyol
sdogruyol / android_aes_encrpytor.java
Created August 5, 2013 12:36
AES Encryption Singleton Class in Android Using CBC / PKCS7Padding
import java.io.UnsupportedEncodingException;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
@dominicthomas
dominicthomas / Android - Launch another app
Created November 28, 2013 16:16
Launch another app using an intent with package name if app has a launcher activity or using package name and class name of main activity.
// only works if app has a launcher activity
Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.example.yourapp");
startActivity(launchIntent);
// works if we know the name of the main activity, even if not a launcher
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setClassName("com.example.yourapp", "com.example.yourapp.MainActivity");
startActivity(intent);
@wbroek
wbroek / genymotionwithplay.txt
Last active February 12, 2024 03:22
Genymotion with Google Play Services for ARM
NOTE: Easier way is the X86 way, described on https://www.genymotion.com/help/desktop/faq/#google-play-services
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip)
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - gapps-L-4-21-15.zip)
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
@SeanZoR
SeanZoR / ProGuard_ignore_libraries
Last active January 7, 2021 17:15
ProGuard - simple ignore for 3rd party libraries
# Ignoring all of the external "org" libraries
# (for example org.apache & org.jackson)
-keep class org.** { *; }
-dontwarn org.**
# Have more? Simply add them like the one above,
# and change to the desired package name.
@egslava
egslava / WrapContentHeightViewPager.java
Created August 12, 2014 12:28
Wrap content height ViewPager (Android)
package org.cnii.layoutloader.ui;
import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.View;
/**
* Special thanks to Daniel López Lacalle for his response
* (http://stackoverflow.com/questions/8394681/android-i-am-unable-to-have-viewpager-wrap-content/20784791#20784791)
@Alezhka
Alezhka / IntentHelper.java
Last active July 23, 2021 10:07
Open file with default application using Intents
/**
* Send email.
*
* @param context the context
* @param email the email
* @param subject the subject
* @param text the text
*/
public void sendEmail(Context context, String email, String subject,
String text) {
@morgotth
morgotth / FooAdapter.java
Last active October 26, 2019 14:12
Recycled Pager Adapter inspired by RecyclerView
package com.example;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.Foo;
import com.example.RecycledPagerAdapter;
public class FooAdapter extends RecycledPagerAdapter<FooViewHolder> {
@bmutinda
bmutinda / SwipeEvents.java
Last active May 2, 2023 22:38
Android swipe events detector
package bmutinda.com.androidutils.libs;
import android.view.MotionEvent;
import android.view.View;
/**
* Created by Mutinda Boniface on 7/5/2015.
*/
public class SwipeEvents implements View.OnTouchListener {
private SwipeCallback swipeCallback;