I am trying to implement the following background for the application...
For the background image(application background) ... i am setting the image in setContentView(layout)... by adding this line, i am getting a runtime exception...
if i set this background in the subactivities..i wont get the background to fill the full application background.. any idea whats the alternative?
public class HMITabActivity extends TabActivity{
private TabHost tabHost = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.background);
tabHost = getTabHost();
tabHost.setOnTabChangedListener(new OnTabChangeListener() {
@Override
public void onTabChanged(String tabId) {
setTabHostColors();
}
});
tabHost.addTab(tabHost.newTabSpec("Tasks")
.setIndicator("Tasks", getResources().getDrawable(R.drawable.icon_task))
.setContent(new Intent(this, Tasks.class)));
tabHost.addTab(tabHost.newTabSpec("HMI")
.setIndicator("HMI", getResources().getDrawable(R.drawable.icon_hmi))
.setContent(new Intent(this, HMI.class)));
tabHost.addTab(tabHost.newTabSpec("Diagnostics")
.setIndicator("Diagnostics", getResources().getDrawable(R.drawable.icon_diagnostics))
.setContent(new Intent(this, Diagnostics.class)));
tabHost.addTab(tabHost.newTabSpec("About")
.setIndicator("About", getResources().getDrawable(R.drawable.icon_info))
.setContent(new Intent(this, Tasks.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)));
Intent intent = new Intent(BackgroundService.class.getName());
startService(intent);
}
private void setTabHostColors() {
for(int i=0;i<tabHost.getTabWidget().getChildCount();i++) {
tabHost.getTabWidget().getChildAt(i).setBackgroundColor(Color.rgb(1, 1, 1)); //unselected
}
tabHost.getTabWidget().getChildAt(tabHost.getCurrentTab()).setBackgroundColor(Color.rgb(50, 120, 160)); // selected
}
}