Monday, August 15, 2011

Tabhost Problem Android Tab Layout Example for Android in Eclipse


Changes from the example:

1. Create new classes for all activities: AlbumsActivity, ArtistsActivity, and SongsActivity (note you will have 3 additional .java files for these.

Add the onCreate method for each of the activities so when they are instantiated the UI tab does something so you can see it at work.

examples:
AlbumsActivity.java
package com.hhicg.hellotabwidget;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class AlbumsActivity extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView textview = new TextView(this);
textview.setText("This is the Albums tab");
setContentView(textview);
}
}

ArtistsActivity.java

package com.hhicg.hellotabwidget;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class ArtistsActivity extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

TextView textview = new TextView(this);
textview.setText("This is the Artists tab");
setContentView(textview);
}
}

package com.hhicg.hellotabwidget;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class SongsActivity extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView textview = new TextView(this);
textview.setText("This is the Songs tab");
setContentView(textview);
}
}


3. For each activity there must be an entry in the manifest. ie for the AndroidManifest.xml
package="com.hhicg.hellotabwidget" android:versionCode="1" android:versionName="1.0"> android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar"> android:label="@string/app_name"> android:label="@string/app_name"> android:label="@string/app_name">

4. In Eclipse you will need to create a new folder drawable to contain the referenced images and the ic_tab_artist.xml.

5. The Main.xml should be the same the example although the layout does not render properly in the ide..



6. This is what my ide looks like











This is the second example Ive tried using java, android and eclipse.. hopefully it saves you all some time.

Thursday, August 11, 2011

Windows XP wont run windows update

I had a problem where Windows XP would not run windows updates on a new install of Windows XP in a VMWare virtual machine.

I tried several methods to get it to work including registering windows update in the registry, as well as installing SP2 and SP3. Nothing worked until I tried this:

http://support.microsoft.com/kb/943144



That worked. Now windows update is working fine..

HHI Computer Guys found this little tidbit. Hope it helps somebody else out.