Error: Intent, View cannot be resolved to a type.

You may get this error during compilation of the Android project if you have declared/used a Intent variable in your code. The error appears because the Intent type is unknown to compiler, I mean you have not included a library which describes the Intent type. 


Resolution: 
In order to resolve the error include following line in our project 
    import android.content.Intent;


Including the above line will cause compiler to search the Indent definition which is declared in android.content.Indent package.
You may also get "Error: View cannot be resolved to a type" if you have used View object in your code.  To resolve view related error "import android.view.View;" in your code.





Error : Move 'classname.java' to the default package.

During development of android application using eclipse you may get this error. 
Cause of this error is the class which you have declared with "classname" is not included in any of the package. 


Resolution: 
In order to resolve this error the newly declared class should be included in your application specific package or under default package. Default package is your application default package. 
Just add a line "package packagename;" at the top of your "calssname.java" file, will resolve the error.


Click on the error icon shown in the eclipse editor, it will show you two options either to move class in your application specific package or to move in default package.


A Java package is a mechanism for organizing Java classes into namespaces. Packages are typically used to organize classes belonging to the same category or providing similar functionality. Java packages can be stored in compressed files called JAR files, allowing classes to download faster as a group rather than one at a time.

Error: This text field does not specify an inputType or a hint

If you have used EditText field in your android project you may get this error. EditText support multiple input type hence the error. 
E.g: You will get this error if you declare EditText as below:


    <EditText
        android:id="@+id/editText1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ems="10" >
        <requestFocus />
    </EditText>

Resolution: Include input type in the edittext field as below 

    <EditText
        android:id="@+id/editText1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ems="10"
        android:inputType="text" >
        <requestFocus />

    </EditText>
 

Warning : Hardcoded string "str", should use @string resource

Eclipse sometimes show a warning "Hardcoded string "str", should use @string resource.", while compiling an Android project. 
E.g: you might have used text view as below, and set the text directly in the layout xml



    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="This is text View" />

Resolution: Declare the string resource in strings.xml, present under values folder. Use the variable instead of the value that you have set.   


E.g.: for above text view declare string resource  as below :
 <string name="info">
This is text View
</string>


and update the text view as below:

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/info" />

Golang: Http POST Request with JSON Body example

Go standard library comes with "net/http" package which has excellent support for HTTP Client and Server.   In order to post JSON ...