Changeset View
Changeset View
Standalone View
Standalone View
src/it/reyboz/bustorino/backend/utils.java
Show First 20 Lines • Show All 115 Lines • ▼ Show 20 Lines | public abstract class utils { | ||||
/** | /** | ||||
* Open an URL in the default browser. | * Open an URL in the default browser. | ||||
* | * | ||||
* @param url URL | * @param url URL | ||||
*/ | */ | ||||
public static void openIceweasel(String url, Context context) { | public static void openIceweasel(String url, Context context) { | ||||
Intent browserIntent1 = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); | Intent browserIntent1 = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); | ||||
if (browserIntent1.resolveActivity(context.getPackageManager()) != null) { | |||||
//check we have an activity ready to receive intents (otherwise, there will be a crash) | |||||
context.startActivity(browserIntent1); | context.startActivity(browserIntent1); | ||||
} | } | ||||
} | |||||
/** | /** | ||||
* Print the first i lines of the the trace of an exception | * Print the first i lines of the the trace of an exception | ||||
* https://stackoverflow.com/questions/21706722/fetch-only-first-n-lines-of-a-stack-trace | * https://stackoverflow.com/questions/21706722/fetch-only-first-n-lines-of-a-stack-trace | ||||
*/ | */ | ||||
/* | /* | ||||
public static String traceCaller(Exception ex, int i) { | public static String traceCaller(Exception ex, int i) { | ||||
StringWriter sw = new StringWriter(); | StringWriter sw = new StringWriter(); | ||||
Show All 17 Lines |
Public contents are in Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) or GNU Free Documentation License (at your option) unless otherwise noted. · Contact / Register