Breaking News
Home / Android / Android Snippets (page 2)

Android Snippets

Email Validator in Android

The snippet shows an Email Validator using RegEx. package;   import java.util.regex.Matcher; import java.util.regex.Pattern;   public class EmailValidator {           private Pattern pattern;         private Matcher matcher;           private static final String EMAIL_PATTERN = "^[_A-Za-z0-9-+]+(.[_A-Za-z0-9-]+)*@"       …

Read More »

How do you uninstall an Android App using ADB?

In order to uninstall/delete an existing App on the device you can either Uninstall from the Device it self as any other regular app. This way of uninstalling requires more steps,  developers can do it faster via the ADB  tool using the following command: adb shell am start -a android.intent.action.DELETE …

Read More »

How do you configure Google Analytics v2 lib in Android?

Answer Create an xml file in the res/values directory called as analytics.xml <?xml version=”1.0″ encoding=”utf-8″ ?> <resources xmlns:tools=”” tools:ignore=”TypographyDashes”>  <!–Replace placeholder ID with your tracking ID–>  <string name=”ga_trackingId”>UA-41303275-1</string>   <!–Enable automatic activity tracking–>  <bool name=”ga_autoActivityTracking”>true</bool>   <!–Enable automatic exception tracking–>  <bool name=”ga_reportUncaughtExceptions”>true</bool>    <bool name=”ga_debug”>false</bool></resources> <!

Read More »

How do you define Colors Resources in Android?

Answer Create an xml file in the res/values directory called as colors.xml <?xml version=”1.0″ encoding=”utf-8″?><resources>    <color name=”White”>#FFF</color>    <color name=”Black”>#000</color>    <color name=”Grey”>#7F7F7F</color>    <color name=”DarkGrey”>#4F4F4F</color>    <color name=”Green”>#0F0</color>    <color name=”TransparentGrey”>#7F000000</color></resources>    You can define what ever colors you want as resources as it is shown above. Once defined, the Android compiler will automatically create …

Read More »
Advertisment ad adsense adlogger