Skip to content

Instantly share code, notes, and snippets.

View RobGThai's full-sized avatar
🎯
Focusing

Poohdish Rattanavijai RobGThai

🎯
Focusing
  • Bangkok, Thailand
View GitHub Profile
@RobGThai
RobGThai / sublime_gist
Created February 11, 2014 08:42
Test gist
{"keyword":"ps4","limit":"15","page":"1","price":{"price":"2000","search_type":"lower"}}
@RobGThai
RobGThai / gist:8311559
Created January 8, 2014 03:58
Error log when run Test application using GoogleInstrumentationTestRunner and Espresso.
01-08 10:41:37.473 8095-8095/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to instantiate instrumentation ComponentInfo{com.app.dealfish.main/com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner}: java.lang.ClassNotFoundException: Didn't find class "com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner" on path: /system/framework/android.test.runner.jar:/data/app/com.app.dealfish.main-1.apk:/data/app/com.app.dealfish.main-1.apk
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4333)
at android.app.ActivityThread.access$1300(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1294)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNat
@RobGThai
RobGThai / Service.java
Created October 14, 2013 17:34
Good javadoc example from android.app.Service.java
/**
* Called by the system every time a client explicitly starts the service by calling
* {@link android.content.Context#startService}, providing the arguments it supplied and a
* unique integer token representing the start request. Do not call this method directly.
*
* <p>For backwards compatibility, the default implementation calls
* {@link #onStart} and returns either {@link #START_STICKY}
* or {@link #START_STICKY_COMPATIBILITY}.
*
* <p>If you need your application to run on platform versions prior to API
@RobGThai
RobGThai / Utils.java
Created June 21, 2013 07:26
Version checking basic
/**
* Use this method to compare if the latest version is newer than current version or not.
* @param currentVersion current version
* @param latestVersion latest version
* @return true if newer
*/
public boolean isNewerVersion(String currentVersion, String latestVersion){
boolean result = false;
/**
* Update single item inside {@link ListView}.
* @param target {@link Object} object to update view.
*/
private void refreshListItem(Object target){
ListView list = getListView();
// Find position of the first visible row
int start = list.getFirstVisiblePosition();
// Find position of the last visible row
int end = list.getLastVisiblePosition();
@RobGThai
RobGThai / ImageLoader.java
Created July 24, 2012 07:02
ImageLoader for lazyloading
/*
* Copyright (c)2012 Poohdish Rattanavijai
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@RobGThai
RobGThai / KML Snippet
Created July 23, 2012 10:34
Snippet code for parsing KML file from Google Maps
/**
* Retrieve navigation data set from either remote URL or String
* @param url
* @return navigation set
*/
public static NavigationDataSet GetNavigationDataSet(String url) {
NavigationDataSet navigationDataSet = null;
try
{
@RobGThai
RobGThai / KML Snippet
Created July 23, 2012 10:33
Snippet code for parsing KML file from Google Maps
/**
* Retrieve navigation data set from either remote URL or String
* @param url
* @return navigation set
*/
public static NavigationDataSet GetNavigationDataSet(String url) {
NavigationDataSet navigationDataSet = null;
try
{
@RobGThai
RobGThai / Placemark.java
Created July 23, 2012 10:30
PlaceMark representing Google Map KML Placemark
/*
* Copyright (c)2012 Poohdish Rattanavijai
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@RobGThai
RobGThai / NavigationDataSet
Created July 23, 2012 10:29
For storing PlaceMark object from KML
/*
* Copyright (c)2012 Poohdish Rattanavijai
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software