/** * */ package org.commcare.dalvik.activities; import org.commcare.dalvik.R; import android.app.TabActivity; import android.content.Intent; import android.content.res.Resources; import android.os.Bundle; import android.widget.TabHost; /** * @author ctsims * */ public class PhoneLogActivity extends TabActivity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.phone_logs); this.setTitle("CommCare ODK"); Resources res = getResources(); // Resource object to get Drawables TabHost tabHost = getTabHost(); // The activity TabHost TabHost.TabSpec spec; // Resusable TabSpec for each tab Intent intent; // Reusable Intent for each tab // Create an Intent to launch an Activity for the tab (to be reused) intent = new Intent().setClass(this, CallLogActivity.class); // Initialize a TabSpec for each tab and add it to the TabHost spec = tabHost.newTabSpec("calllogs").setIndicator("Calls", res.getDrawable(android.R.drawable.sym_action_call)).setContent(intent); tabHost.addTab(spec); // Do the same for the other tabs intent = new Intent().setClass(this, MessageLogActivity.class); spec = tabHost.newTabSpec("messages").setIndicator("Messages", res.getDrawable(android.R.drawable.ic_dialog_email)) .setContent(intent); tabHost.addTab(spec); tabHost.setCurrentTab(0); } }