Error: The method loadUrl(String) is undefined for the type Activity

If you are trying to build an Android Application using PhoneGap/Apache Cordova, you may get this error.
The error may occur in two conditions :
  • You have not included the PhoneGap.jar / cordova-2.0.0.jar to your build path. To do so, first copy the jar file to /libs directory under project directory.  Then right click on project directory in eclipse, click "Build Path -> Configure Build Path". Under Java Build Path Select Libraries tab and click on "Add JARs" button. Choose the copied jar file from "lib" directory.  
  • You have not extended your activity from DroidGap. Check the java source file of your project the main activity should be derived from DroidGap as below:
    public class MainActivity extends DroidGap.
This should resolve the error.

How to switch boot order within Windows & Linux

If you have both Windows and Linux installed on your computer, default  booting operating system would be Linux.
If you are frequent Windows user than Linux, the default booting OS(Operating System) should be Windows else you will waste time in every time choose boot to Windows.
Note that to change the boot sequence you will require the root level access as you are going to modify "/boot/grub/grub.cfg".
If you are using x windows system, open the file "/boot/grub/grub.cfg" using any text editor. If you don't have root level access then open text editor using sudo command as:
sudo -u root gedit 
Then open the file grub.cfg. In the grub.cfg search for "menuentry" and check for menuentry having "Windows " loader line.
Count the number of menuentries before Windows entry. Do not count Windows entry as menu entry start from 0. Set the counted value at:
set default="0" 
in the grub.cfg file as set default="5" now save the grub.cfg file and you are done. Just restart the computer and check if the changes are reflected on boot loader.
Alternatively you can do above easily with terminal as below.
  • Open the terminal by pressing buttons "Ctrl + Alt + T" ( Control + Alt + T). 
  • On terminal type following command:
           cat /boot/grub/grub.cfg | grep menuentry
  • This will print output as below 
  
  • Count the menuentry till the Windows entry. The counting should start from 0.
  • Now edit the file using command sudo -u root vi /boot/grub/grub.cfg
  • Update the counted value instead of set default="0" as lets say in above case it is 8 so, set default="5".
  • Save the file, and restart the computer. 
Note: While counting for "menuentry" make sure that count one menuentry for all "menuentry" present under submenu such as in above image submenu "Previous Linux versions"{ }. For this you will have to open file in text editor or cat completed file on terminal, to check what entries present under Submenu.

How to flash CWM Recovery to Samsung Galaxy SL( GT-I9003) using Odin

** I Will Not responsible for any damage done with use of below mentioned methods. **
To flash the CWM recovery to your Samsung Galaxy SL you will require to following things in place:
  1. Odin  : you can download it from here.
  2. CWM Recovery image : you can download it from here. Thanks to XDA-developers.
  3. USB driver to connect your phone with computer. Install Samsung Kias so it will install the USB driver.
Once you have downloaded above required items and installed the USB driver, reboot you phone to download mode. You can read how to reboot phone in download mode from here.
Now connect the phone with USB cable to computer. 
  • Extract the Odin from the zip file that you have downloaded at some location on your computer and launch the Odin executable by double clicking it. Wait for Odin to detect your phone.
  • You will be able to see it in yellow once detected on odin screen as shown below.

  • Click the PDA button to select the CWM recovery image. 
  • Once you have selected the recovery image, check the odin options on your screen are same as marked in red in above image.
  • Now click Start button. During this operation do not disconnect the phone.
  • Once Odin completes the update your phone will restart now you can remove your phone from computer. If the flashing is completed Odin screen will look like below.
Now reboot to recovery mode to check the CWM recovery has been installed or not. 
To know how to reboot to recovery mode click here.

How to boot Samsung Galaxy SL( GT-I9003) in download mode

Power off your Samsung Galaxy SL (GT- I9003) to start in download mode.
Once you have power off the phone, press and Hold Volume DOWN and HOME button. Make sure you have hold volume up, and don't press in the middle of the volume buttons. 
Now keep pressing these two buttons(VOL DOWN + HOME) and press POWER button. Keep pressing these Buttons, until you see the screen shown below.
Once you see download mode screen release all the buttons. Now you have entered to download mode.


How to boot Samsung Galaxy SL( GT-I9003) in recovery mode

Power off your Samsung Galaxy SL (GT- I9003) to start in recovery mode.
Once you have power off the phone, press and Hold Volume UP and Home button. Make sure you have hold volume up, don't press in  the middle of the volume buttons. 
Now keep pressing these two buttons(VOL UP + HOME) and press power button for 2-3 seconds. Release only power button, but keep pressing Volume Up + Home Button, until you see the screen shown below.
Once you see recovery screen release the Home button else your phone will restart as first selected option will be restart and pressing home will make that happen.

In the recovery mode, volume up & down act as a up scroll and down scroll buttons, by pressing Home button you will be able to click the selected option.

Error: Invalid layout param in a LinearLayout: layout_alignParentTop

The error "Invalid layout param in a LinearLayout: layout_alignParentTop or layout_centerHorizontal or layout_centerVertical or layout_alignParentLeft" occurs when you have declared the Linear Layout but included these layout parameters for the button, textview or any other layout element.

Removing these attribute such as "alignParentTop" declared for any of the layout element such as textview or button will resolve the error.

For an example you may get above error if you have declared linear layout as below:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="34dp"
        android:layout_marginTop="61dp"
        android:text="@string/hello_world" />
</LinearLayout>

To resolve the error remove lines marked in red.

How to access files on Android Mobile to Ubuntu/Linux

Connect your Android mobile to the computer. If the connection is detected by mobile then change the USB connection setting on phone to "Mass storage". Even after this if you are not able to access the files on your Ubuntu, follow below steps.
  1. Connect your mobile using USB cable.
  2. Execute "lsusb" command on terminal as  : $ sudo lsusb
  3. In the output displayed by lsusb command check if your mobile device is listed or not. Ideally it should be displayed with your mobile device vendor ( LG, Samsung, HTC etc...) or with Google Inc. name.
  4. If you are able to locate the device in the list then unplug the device from computer.
  5. Now install the newest Version of "libmtp" by following steps mentioned in the post http://www.humans-enabled.com/2011/12/how-to-fix-samsung-galaxy-nexus-mtp.html
  6. Once you have installed "libmtp", you can connect your device and use gMTP to view the files on device.

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 ...