|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.todoroo.andlib.utility.AndroidUtilities
public class AndroidUtilities
Android Utility Classes
Nested Class Summary | |
---|---|
static interface |
AndroidUtilities.SerializedPut<T>
|
Field Summary | |
---|---|
static java.lang.String |
SEPARATOR_ESCAPE
|
static java.lang.String |
SERIALIZATION_SEPARATOR
|
Constructor Summary | |
---|---|
AndroidUtilities()
|
Method Summary | ||
---|---|---|
static Property<?>[] |
addToArray(Property<?>[] list,
Property<?>... newItems)
Join items to a list |
|
static android.os.Bundle |
bundleFromSerializedString(java.lang.String string)
Turn Bundle into a string |
|
static java.lang.String |
bundleToSerializedString(android.os.Bundle source)
Serializes a Bundle into a string |
|
static java.lang.Object |
callApiMethod(int minSdk,
java.lang.Object receiver,
java.lang.String methodName,
java.lang.Class<?>[] params,
java.lang.Object... args)
Call a method via reflection if API level is at least minSdk |
|
static java.lang.String |
capitalize(java.lang.String string)
Capitalize the first character |
|
static
|
concat(TYPE[] dest,
TYPE[] source,
TYPE... additional)
Concatenate additional stuff to the end of the array |
|
static android.content.ContentValues |
contentValuesFromSerializedString(java.lang.String string)
Turn ContentValues into a string |
|
static android.content.ContentValues |
contentValuesFromString(java.lang.String string)
Turn ContentValues into a string |
|
static java.lang.String |
contentValuesToSerializedString(android.content.ContentValues source)
Serializes a content value into a string |
|
static java.lang.String[][] |
contentValuesToStringArrays(android.content.ContentValues source)
Rips apart a content value into two string arrays, keys and value |
|
static void |
copyDatabases(android.content.Context context,
java.lang.String folder)
Copy databases to a given folder. |
|
static void |
copyFile(java.io.File in,
java.io.File out)
Copy a file from one place to another |
|
static void |
copyStream(java.io.InputStream source,
java.io.OutputStream dest)
Copy stream from source to destination |
|
static boolean |
equals(java.lang.Object a,
java.lang.Object b)
Returns true if a and b or null or a.equals(b) |
|
static android.graphics.Bitmap |
fetchImage(java.net.URL url)
Fetch the image specified by the given url |
|
static
|
findKeyInMap(java.util.Map<KEY,VALUE> map,
VALUE value)
Search for the given value in the map, returning key if found |
|
static
|
findViewByType(android.view.View view,
java.lang.Class<TYPE> type)
Find a child view of a certain type |
|
static int |
getSdkVersion()
|
|
static java.lang.String |
getSignature(android.content.Context context,
java.lang.String packageName)
Gets application signature |
|
static
|
indexOf(TYPE[] array,
TYPE value)
Return index of value in array |
|
static boolean |
isConnected(android.content.Context context)
|
|
static java.lang.String |
md5(java.lang.String input)
Performs an md5 hash on the input string |
|
static void |
putInto(android.content.ContentValues target,
java.lang.String key,
java.lang.Object value)
Put an arbitrary object into a ContentValues |
|
static java.lang.CharSequence |
readFile(android.content.Context activity,
int id)
From Android MyTracks project (http://mytracks.googlecode.com/). |
|
static android.content.Intent |
remoteIntent(java.lang.String appPackage,
java.lang.String activityClass)
Create an intent to a remote activity |
|
static void |
sleepDeep(long l)
Sleep, ignoring interruption. |
|
static void |
sortFilesByDateDesc(java.io.File[] files)
Sort files by date so the newest file is on top |
|
static void |
startExternalIntent(android.content.Context context,
android.content.Intent intent,
int request)
Start the given intent, handling security exceptions if they arise |
|
static void |
startExternalIntentForResult(android.app.Activity activity,
android.content.Intent intent,
int requestCode)
Start the given intent, handling security exceptions if they arise |
|
static void |
suppressVirtualKeyboard(android.widget.TextView editor)
Suppress virtual keyboard until user's first tap |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String SEPARATOR_ESCAPE
public static final java.lang.String SERIALIZATION_SEPARATOR
Constructor Detail |
---|
public AndroidUtilities()
Method Detail |
---|
public static void suppressVirtualKeyboard(android.widget.TextView editor)
public static boolean isConnected(android.content.Context context)
public static android.graphics.Bitmap fetchImage(java.net.URL url) throws java.io.IOException
java.io.IOException
public static void startExternalIntent(android.content.Context context, android.content.Intent intent, int request)
context
- intent
- request
- request code. if negative, no request.public static void startExternalIntentForResult(android.app.Activity activity, android.content.Intent intent, int requestCode)
activity
- intent
- requestCode
- public static void putInto(android.content.ContentValues target, java.lang.String key, java.lang.Object value)
ContentValues
target
- key
- value
- public static java.lang.String[][] contentValuesToStringArrays(android.content.ContentValues source)
public static <TYPE> int indexOf(TYPE[] array, TYPE value)
array
- array to searchvalue
- value to look for
public static java.lang.String contentValuesToSerializedString(android.content.ContentValues source)
public static java.lang.String bundleToSerializedString(android.os.Bundle source)
Bundle
into a string
public static android.content.ContentValues contentValuesFromSerializedString(java.lang.String string)
string
-
public static android.os.Bundle bundleFromSerializedString(java.lang.String string)
Bundle
into a string
string
-
public static android.content.ContentValues contentValuesFromString(java.lang.String string)
string
-
public static boolean equals(java.lang.Object a, java.lang.Object b)
a
- b
-
public static void copyFile(java.io.File in, java.io.File out) throws java.lang.Exception
in
- out
-
java.lang.Exception
public static void copyStream(java.io.InputStream source, java.io.OutputStream dest) throws java.io.IOException
source
- dest
-
java.io.IOException
public static <TYPE> TYPE findViewByType(android.view.View view, java.lang.Class<TYPE> type)
view
- type
-
public static int getSdkVersion()
public static void copyDatabases(android.content.Context context, java.lang.String folder)
folder
- public static void sortFilesByDateDesc(java.io.File[] files)
files
- public static <KEY,VALUE> KEY findKeyInMap(java.util.Map<KEY,VALUE> map, VALUE value)
map
- value
-
public static void sleepDeep(long l)
l
- public static java.lang.Object callApiMethod(int minSdk, java.lang.Object receiver, java.lang.String methodName, java.lang.Class<?>[] params, java.lang.Object... args)
minSdk
- minimum sdk number (i.e. 8)receiver
- object to call method onmethodName
- method name to callparams
- method parameter typesargs
- arguments
public static java.lang.CharSequence readFile(android.content.Context activity, int id)
activity
- id
-
public static java.lang.String md5(java.lang.String input)
input
-
public static android.content.Intent remoteIntent(java.lang.String appPackage, java.lang.String activityClass)
appPackage
- activityClass
-
public static java.lang.String getSignature(android.content.Context context, java.lang.String packageName)
public static Property<?>[] addToArray(Property<?>[] list, Property<?>... newItems)
TYPE
- list
- newList
- newItems
-
public static <TYPE> TYPE[] concat(TYPE[] dest, TYPE[] source, TYPE... additional)
params
- additional
-
public static java.lang.String capitalize(java.lang.String string)
string
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |