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
To get connected usb devices with their vendor id | |
lsusb | |
The four digits before the colon is the vendor id. | |
Navigate to | |
/etc/udev/rules.d | |
gedit 51-android.rules |
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
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; | |
public class IPAddressValidator{ | |
private Pattern pattern; | |
private Matcher matcher; | |
private static final String IPADDRESS_PATTERN = | |
"^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." + |
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
Option 1 | |
This example takes the default date without any formatting and outputs: 2013-11-15 09:46:33 | |
Date = (TextView) findViewById(R.id.txtDate); | |
String Date= DateFormat.getDateTimeInstance().format(new Date()); | |
textView.setText(Date); | |
Option 2 |
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
100% — FF | |
99% — FC | |
98% — FA | |
97% — F7 | |
96% — F5 | |
95% — F2 | |
94% — F0 | |
93% — ED | |
92% — EB | |
91% — E8 |
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
From android 4.1 / 4.2, the following Roboto font families are available: | |
android:fontFamily="sans-serif" // roboto regular | |
android:fontFamily="sans-serif-light" // roboto light | |
android:fontFamily="sans-serif-condensed" // roboto condensed | |
android:fontFamily="sans-serif-thin" // roboto thin (android 4.2) | |
android:fontFamily="sans-serif-medium" // roboto medium (android 5.0) | |
in combination with this | |
android:textStyle="normal|bold|italic" |
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
adb shell pm clear com.package.name | |
adb devices | |
adb kill-server | |
adb start-server | |
adb help | |
adb push <local> <remote> |
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 boolean isValidPhoneNumber(CharSequence target) { | |
return !TextUtils.isEmpty(target) && Patterns.PHONE.matcher(target).matches() && target.length() < 16; | |
} |
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 boolean validateEmail(final String email) { | |
return email != null && !TextUtils.isEmpty(email) && android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches(); | |
} |
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 int getUnixTimeStamp() { | |
Date date = new Date(); | |
return (int) (date.getTime() / 1000); | |
} |
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 String generateUUID() { | |
UUID uuid = UUID.randomUUID(); | |
String UUID = uuid.toString(); | |
Log.i(TAG, "UUID : " + UUID); | |
Log.i(TAG, "UUID version : " + uuid.version()); | |
Log.i(TAG, "UUID variant : " + uuid.variant()); | |
return UUID; | |
} |
NewerOlder