Skip to content

Instantly share code, notes, and snippets.

View bunjix's full-sized avatar

Benjamin Fellous bunjix

View GitHub Profile
package com.protips.Intent;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.Parcelable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@bunjix
bunjix / KonamiCodeHelper
Created May 19, 2014 09:00
Konami Code Helper
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.Gravity;
import android.widget.EditText;
import android.widget.Toast;
public class KonamiCodeHelper {
private static final String KONAMI_CODE = "UUDDLRLRBA";
public void connectFit() {
if (TextUtils.isEmpty(mGoogleMail)) {
Intent intent = AccountPicker.newChooseAccountIntent(null, null, new String[]{"com.google"},
false, null, null, null, null);
startActivityForResult(intent, GOOGLE_ACCOUNT_PICKER_REQUEST);
return;
}
new AsyncTask<Void, Void, String>() {
@Override
@bunjix
bunjix / Activity_or_Fragment.java
Last active January 9, 2020 10:28
Pick an image on Android
private static final int PICK_PHOTO_FOR_AVATAR = 0;
public void pickImage() {
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("image/*");
startActivityForResult(intent, PICK_PHOTO_FOR_AVATAR);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {