Solution: Running Android Lint has encountered a problem Failed

Problem:

'Running Android Link' has encountered a problem.
Failed
java.lang.NullPointerException
OK         <<Details

Solution:

1. In Visual Studio, from the menu bar, click Window, then Preferences.

2. Expand the Android item from the list on the left, and select Lint Error Checking.

3. Uncheck [  ] When saving files, check for errors.

4. Click OK

5. Close and re-start Visual Studio to test.

Resources:
http://stackoverflow.com/questions/11855352/constant-running-android-lint-failed-nullpointerexception-popping-up-in-eclip

How to Create a ProGuard Exception

This prevents ProGuard from stripping away required classes.

1. In your project directory, open the proguard-project.txt file.

2. Add the following code to the end of the file.

-keep class * extends java.util.ListResourceBundle {
protected Object[][] getContents();
}

-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
public static final *** NULL;
}

-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
@com.google.android.gms.common.annotation.KeepName *;
}

-keepnames class * implements android.os.Parcelable {
public static final ** CREATOR;
}


3. Save project.

Resources:
http://developer.android.com/google/play-services/setup.html#Install


How to Reference a Library in your Project

1. Create or open your Android project.

2. Ensure the Google Play services SDK is installed. It is located in the last folder called Extras.

3. Import the Google Play services library.

4. In the Package Explorer, right-click on your project name, and select Properties from the pop-up menu, or even easier, select your project name and press Alt-Enter.

5. Select Android from the list on the left.

6. Scroll to the bottom to the Library section. Click on the library you'd like to reference to select it then click OK.

Resources:
http://developer.android.com/tools/projects/projects-eclipse.html#ReferencingLibraryProject

How to Import a Library

1. In Eclipse, from the menu, click File, the Import...

2. Expand the Android folder, and select Existing Android Code Into Workspace, and click Next.

3. Click the Browse button, then navigate to your Android SDK folder and find the library you wish to import. For example, to import Google Play services you'd choose the google_play_services folder, then click OK.

..\sdk\extras\google\google_play_services

4. Then click Finish to import it.

Resources:
http://code.tutsplus.com/tutorials/integrating-google-play-services-on-android--cms-19828


How to Install an SDK package

1. Open the SDK Manager

2. Scroll through the list, expanding folders when necessary and check the item(s) you would like to install.

3. Click Install packages... button.


How to Register an Activity that Responds to NFC tags for URI's that point to a URL

This will register an Activity that will respond only to NFC tags that correspond to a URI that points a website (URL).
ACTION_NDEF_DISCOVERED(added in API level 10) is an Intent to start an activity when a tag with NDEF payload is discovered.

1. Add a new activity to your AndroidManifest.xml file. You may add it below  a closing (</activity) tag.

<activity android:name=".BlogViewer">
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED"/>
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="http:"
   android:host="androidsbs.blogspot.com"/>
</intent-filter>
</activity>

2. Compile and run!

Resources:Professional Android 4 Application Development by Reto Meier, pg 694
http://developer.android.com/reference/android/nfc/NfcAdapter.html#ACTION_NDEF_DISCOVERED

How to Set Permission for I/O Operations over NFC

public static final String NFC was added in API level 9
Allows applications to perform I/O operations over NFC

1. In the AndroidManifest.xml file, and add the following line Add the line between the <uses-sdk../> and the <application> tags.

<uses-permission android:name = "android.permission.NFC" />

2. Compile and run!

String.valueOf - How to Convert a Double to a String

public static String valueOf (int value) was added in API level 1
Converts the specified double to its string representation.
Parameters: value - the double.
Returns: the double converted to a string
(** I prefer to use String.valueOf over, Double.toString() **)

1. In the MainActivity.java file, add a Toast which displays the value of String.valueOf(1.11);

Toast.makeText(getBaseContext(), String.valueOf(1.11), Toast.LENGTH_LONG).show(); 

2. Compile and run!
3. The display results will be (as a string): 1.11

Resources:
http://stackoverflow.com/questions/3335737/integer-tostringint-i-vs-string-valueofint-i

findViewbyID - How to Find a RatingBar using ID

findViewbyId was added in API Level 1
findViewById: Look for a child RatingBar with the given id. If this view has a given id, return this RatingBar. The findViewById() method is available to all activities in Android. findViewById allows you to find a view inside an activity layout.

1. Name a RatingBar, in XML named myRatingBar.

2. Declare a RatingBar named myRatingBar.

3. In MainActivity, java file, add the below code to the onCreate method. Where R.id.myRatingBar is the same as the android:id name in your main.xml file, and myRatingBar is the RatingBar name referred to in Java. This returns a RatingBar class and is casted to a RatingBar type so you can work with it.

myRatingBar = (RatingBar) findViewById(R.id.myRatingBar); 

4. Compile and run!

Resources: