This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# built application files | |
*.apk | |
*.ap_ | |
.classpath | |
# files for the dex VM | |
*.dex | |
# Java class files | |
*.class |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
ArrayList<Object> list = getListOfPreExistingItems(); | |
for(int i = 0; ; i++) { | |
Object item = list.get(i) | |
doSomething(item); | |
} | |
} catch (ArrayOutOfBoundsException e) { | |
// loop is over | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* */ 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |