public class ConvertUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static int |
dpToPixels(android.app.Activity context,
int dp)
Dp to pixels
|
static java.lang.String |
hashMap2String(java.util.HashMap<java.lang.String,java.lang.String> params)
Convert HashMap
|
static android.content.Intent |
implicit2ExplicitIntent(android.content.Context context,
android.content.Intent implicitIntent)
Android L (lollipop, API 21) introduced a new problem when trying to invoke implicit intent,
"java.lang.IllegalArgumentException: Service Intent must be explicit"
If you are using an implicit intent, and know only 1 target would answer this intent,
This method will help you turn the implicit intent into the explicit form.
|
static int |
pixelsToDp(android.app.Activity context,
int px)
Pixels to dp int.
|
static int |
pxToSp(android.content.Context context,
float px)
Px to sp
|
static byte[] |
short2byte(short[] sData)
short array to byte array.
|
static int |
spToPx(android.content.Context context,
float sp)
Sp to px
|
static java.util.HashMap<java.lang.String,java.lang.String> |
string2HashMap(java.lang.String paramString)
Convert key=value type String to HashMap
|
public static byte[] short2byte(short[] sData)
sData
- the s datapublic static android.content.Intent implicit2ExplicitIntent(android.content.Context context, android.content.Intent implicitIntent)
context
- the contextimplicitIntent
- - The original implicit intentpublic static int dpToPixels(android.app.Activity context, int dp)
context
- the contextdp
- the dppublic static int pixelsToDp(android.app.Activity context, int px)
context
- the contextpx
- the pxpublic static int spToPx(android.content.Context context, float sp)
context
- the contextsp
- the sppublic static int pxToSp(android.content.Context context, float px)
context
- the contextpx
- the pxpublic static java.lang.String hashMap2String(java.util.HashMap<java.lang.String,java.lang.String> params)
params
- the paramspublic static java.util.HashMap<java.lang.String,java.lang.String> string2HashMap(java.lang.String paramString)
paramString
- the param string