Thursday, December 30, 2010

Eclipse Errors

All the errors are cleared, but they are still in the Problems list and the project won't build.

Select the error in the problems list and click the delete button.
Clean the project by using the menu option Project >  Clean.
Rebuild and try again.

AndroidManifest XML file

Adding Activity to Android Project


I followed the Tab Layout Tutorial on Android Developers (http://developer.android.com/resources/tutorials/views/hello-tabwidget.html), but couldn't get the tabs to work.


When you add activity classes to the project, you must and the activity to the android manifest (AndroidManifest.xml) file.


Example:
public class SecondTab extends Activity {
...
}


must have the following line in the AndroidManifest.xml file
<activity android:name=".SecondTab" />



Adding uses-permission


Must be in the manifest portion of the xml file


Example:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.???.???"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/app_name">
    ...
    </application>
    <uses-permission android:name="android.permission.INTERNET" />
</manifest>