Skip to content

Instantly share code, notes, and snippets.

View yishai-glide's full-sized avatar

thepoosh yishai-glide

  • Glide
  • Jerusalem IL
View GitHub Profile
@override
public void onCreate() {
initCrashHandeling();
/// other init code
AppRight.start(this, GRYPHONET_APP_ID, LifeCyclePhase.DEVELOPMENT ,true);
}
private void initCrashHandeling(){
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
@Override
# built application files
*.apk
*.ap_
.classpath
# files for the dex VM
*.dex
# Java class files
*.class
// create CUSTOMER table
db.execSQL("CREATE TABLE \"CUSTOMER\" (" + //
"\"_id\" INTEGER PRIMARY KEY ," + // 0: id
"\"NAME\" TEXT NOT NULL );"); // 1: name
// create NOTE table
db.execSQL("CREATE TABLE \"NOTE\" (" + //
"\"_id\" INTEGER PRIMARY KEY ," + // 0: id
"\"TEXT\" TEXT NOT NULL ," + // 1: text
"\"COMMENT\" TEXT," + // 2: comment
"\"DATE\" INTEGER);"); // 3: date
public static void scheduleAutoCancel(@NonNull Context context) {
Intent intent = new Intent(context, MyReceiver.class);
AlarmManager manager = (AlarmManager)context.getSystemService(ALARM_SERVICE);
int requestCode = REQUEST_CODE;
PendingIntent action = PendingIntent.getBroadcast(context, requestCode, intent, PendingIntent.FLAG_UPDATE_CURRENT);
long when = System.currentTimeMillis() + TIME_TO_WAUT_UNTIL_NOTIFICATION;
manager.set(AlarmManager.RTC, when, action);
}
public static class MyReceiver extends BroadcastReceiver {
Point mCenter;
float mRadious;
public float animateToX(Point src, float deltaX) {
float newX = src.x + deltaX;
float newY = mCenter.y + Math.sqrt(Math.pow(mRadious, 2) - Math.pow(newX - mCenter.x), 2));
return newY;
}
try {
ArrayList<Object> list = getListOfPreExistingItems();
for(int i = 0; ; i++) {
Object item = list.get(i)
doSomething(item);
}
} catch (ArrayOutOfBoundsException e) {
// loop is over
}
// Add code to print out the key hash
try {
PackageInfo info = getPackageManager().getPackageInfo(
"com.facebook.samples.hellofacebook",
PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
}
/* */ package android.support.design.widget;
/* */
/* */ import android.content.Context;
/* */ import android.content.res.ColorStateList;
/* */ import android.content.res.Resources.Theme;
/* */ import android.content.res.TypedArray;
/* */ import android.graphics.Canvas;
/* */ import android.graphics.Paint;
/* */ import android.os.Handler;
/* */ import android.os.Handler.Callback;
private static UncaughtExceptionHandler exceptionHandler = new Thread.UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread thread, Throwable ex) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
ex.printStackTrace(pw);
ex.printStackTrace();
Runnable onPostExecute = new Runnable() {
@Override
public void parseString(String str) {
if(TextUtils.isEmpty(str)) {
// nothing here
return;
}
String[] words = str.split(" ");
StringBuilder sentence = new StringBuilder(str.length());
int l_integer;
double l_double;