Back to project page african-art-talent-discovery.
The source code is released under:
GNU General Public License
If you think the Android project african-art-talent-discovery listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.ekoconnect.afriphotos; //from ww w . ja v a 2 s .c o m import android.app.TabActivity; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.FragmentTabHost; import android.view.LayoutInflater; import android.view.View; import android.widget.ImageView; import android.widget.TabHost; import android.widget.TextView; import com.actionbarsherlock.app.SherlockFragmentActivity; import com.ekoconnect.afriphoto.fragments.Home; @SuppressWarnings("deprecation") public class MainActivity extends TabActivity { TabHost tabHost; /** Called when the activity is first created. */ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tab_layout); tabHost = getTabHost(); setTabs(); } private void setTabs() { addTab("HomeActivity", R.drawable.tab_home, CameraActivity.class); addTab("Search", R.drawable.tab_search, MyPhotos.class); addTab("Fake", R.drawable.tab_search, MyPhotos.class); addTab("HomeActivity", R.drawable.tab_home, CameraActivity.class); addTab("Search", R.drawable.tab_search, MyPhotos.class); } private void addTab(String labelId, int drawableId, Class<?> c) { Intent intent = new Intent(this, c); TabHost.TabSpec spec = tabHost.newTabSpec("tab" + labelId); View tabIndicator = LayoutInflater.from(this).inflate(R.layout.tab_indicator, getTabWidget(), false); TextView title = (TextView) tabIndicator.findViewById(R.id.title); title.setText(labelId); ImageView icon = (ImageView) tabIndicator.findViewById(R.id.icon); icon.setImageResource(drawableId); spec.setIndicator(tabIndicator); spec.setContent(intent); tabHost.addTab(spec); } public void openCameraActivity(View b) { Intent intent = new Intent(this, CameraActivity.class); startActivity(intent); } }