As we
know Tab-Activity is now depreciated in Android, but some time we use
it for create simple Tab pages in our application. So today I am going
to share tutorial for Tab Host Activity in android. It is a simple tab
activity demo, group child activity and pager tab example I will share
soon. Hope my blog help you. Please follow step by step my blog for
create simple Tab Layout-
// Create an Intent to launch an Activity for the tab (to be reused)
intent = new Intent().setClass(this, HomeActivity.class);
spec = tabHost.newTabSpec("home")
.setIndicator("HOME", res.getDrawable(R.drawable.home))//set here
.setContent(intent);
tabHost.addTab(spec);
7)Add images - home.png, about.png, contact.png in drawable download below images-
8)Add activity in manifest.xml
9)Run your project and enjoy :)
Print Screen:
1)Create a new project, name TabHostDemo.
2)Create an TabHostActivity and extend it to TabActivity.
3)Create 3 other activity name-Homeactivity, AboutActivity, ContactActivity.
4)Create layout activity_tab_host.xml .
5)Create another 3 layout for Home, About, Contact Activity, name activity_home, activity_about, activity_contact.
6)Do optional activity for change tab images on selection.Create ic_tab_home, ic_tab_about, ic_tab_contact.
Note-this step is not must, you can direct put your images in your TabHostActivity-
intent = new Intent().setClass(this, HomeActivity.class);
spec = tabHost.newTabSpec("home")
.setIndicator("HOME", res.getDrawable(R.drawable.home))//set here
.setContent(intent);
tabHost.addTab(spec);
7)Add images - home.png, about.png, contact.png in drawable download below images-
8)Add activity in manifest.xml
9)Run your project and enjoy :)
import android.app.TabActivity; import android.content.Intent; import android.content.res.Resources; import android.os.Bundle; import android.widget.TabHost; public class TabHostActivity extends TabActivity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_tab_host); Resources res = getResources(); // Resource object to get Drawables TabHost tabHost = getTabHost(); // The activity TabHost TabHost.TabSpec spec; // Reusable 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, HomeActivity.class); spec = tabHost.newTabSpec("home") .setIndicator("HOME", res.getDrawable(R.drawable.ic_tab_home)) .setContent(intent); tabHost.addTab(spec); // Do the same for the other tabs intent = new Intent().setClass(this, AboutActivity.class); spec = tabHost.newTabSpec("about") .setIndicator("ABOUT", res.getDrawable(R.drawable.ic_tab_about)) .setContent(intent); tabHost.addTab(spec); intent = new Intent().setClass(this, ContactActivity.class); spec = tabHost .newTabSpec("contact") .setIndicator("CONTACT", res.getDrawable(R.drawable.ic_tab_contact)) .setContent(intent); tabHost.addTab(spec); //set tab which one you want open first time 0 or 1 or 2 tabHost.setCurrentTab(0); } }
HomeActivity.java
import android.app.Activity; import android.os.Bundle; public class HomeActivity extends Activity{ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); } }AboutActivity.java
import android.app.Activity; import android.os.Bundle; public class AboutActivity extends Activity{ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_about); } }ContactActivity.java
import android.app.Activity; import android.os.Bundle; public class ContactActivity extends Activity{ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_contact); } }activity_tab_host.xml
Activity_Home.xml
activity_about.xml
Android Manifest file
For further files download the zippedfile and enjoyy!!!!!!!! keep smiling and commenting
13) DOWNLOAD ZIP CODE
Please feel free to post your testimonials regarding my work here. Please leave your review by clicking on comment below this post.
Thanks.
For most business owners, making the decision to implement an IVR or voice response software is easy. Here are some tips for choosing IVRs and providers that will benefit you the most.Interactive Voice Response System
ReplyDeleteBurberry Outlet
ReplyDeleteOakley Eyeglasses Michael Kors Outlet Coach Factory Outlet Coach Outlet Online Coach Purses Kate Spade Outlet Toms Shoes North Face Outlet Coach Outlet Gucci Belt North Face Jackets Oakley Sunglasses Toms Outlet North Face Outlet Nike Outlet Nike Hoodies Tory Burch Flats Marc Jacobs Handbags Jimmy Choo Shoes Jimmy Choos
Burberry Belt Tory Burch Boots Louis Vuitton Belt Ferragamo Belt Marc Jacobs Handbags Lululemon Outlet Christian Louboutin Shoes True Religion Outlet Tommy Hilfiger Outlet
Michael Kors Outlet Coach Outlet Red Bottoms Kevin Durant Shoes New Balance Outlet Adidas Outlet Coach Outlet Online Stephen Curry Jersey
chenenen0506
ReplyDeletetory burch boots
jordan retro 11
nike trainers uk
air force 1
cheap toms
louis vuitton outlet
kate spade outlet
louis vuitton outlet stores
true religion jeans
celine handbags
nike store
air max 90
jordan retro 8
coach outlet
louis vuitton purses
cheap jordans
hollister uk
tory burch outlet online
pandora outlet
fitflops shoes
michael kors outlet
jordan 11
discount jordans
louis vuitton outlet
hollister
christian louboutin shoes
kobe 10
gucci handbags
christian louboutin sale
fit flops
Skechers Go Walk Adidas Yeezy Boost Adidas Yeezy Adidas NMD Coach Outlet North Face Outlet Ralph Lauren Outlet Puma SneakersPolo Outlet
ReplyDeleteUnder Armour Outlet Under Armour Hoodies Herve Leger MCM Belt Nike Air Max Louboutin Heels Jordan Retro 11 Converse Outlet Nike Roshe Run UGGS Outlet North Face Outlet
Adidas Originals Ray Ban Lebron James Shoes Sac Longchamp Air Max Pas Cher Chaussures Louboutin Keds Shoes Asics Shoes Coach Outlet Salomon Shoes True Religion Outlet
New Balance Outlet Skechers Outlet Nike Outlet Adidas Outlet Red Bottom Shoes New Jordans Air Max 90 Coach Factory Outlet North Face Jackets North Face Outlet
fila
ReplyDeletegolden gooses
adidas yeezy
air max 95
kyrie 6
curry 5 shoes
curry 5
coach outlet
yeezy shoes
jordan shoes
no deposit bonus forex 2021 - takipçi satın al - takipçi satın al - takipçi satın al - takipcialdim.com/tiktok-takipci-satin-al/ - instagram beğeni satın al - instagram beğeni satın al - google haritalara yer ekleme - btcturk - tiktok izlenme satın al - sms onay - youtube izlenme satın al - google haritalara yer ekleme - no deposit bonus forex 2021 - tiktok jeton hilesi - tiktok beğeni satın al - binance - takipçi satın al - uc satın al - finanspedia.com - sms onay - sms onay - tiktok takipçi satın al - tiktok beğeni satın al - twitter takipçi satın al - trend topic satın al - youtube abone satın al - instagram beğeni satın al - tiktok beğeni satın al - twitter takipçi satın al - trend topic satın al - youtube abone satın al - instagram beğeni satın al - tiktok takipçi satın al - tiktok beğeni satın al - twitter takipçi satın al - trend topic satın al - youtube abone satın al - instagram beğeni satın al - perde modelleri - instagram takipçi satın al - instagram takipçi satın al - cami avizesi - marsbahis
ReplyDeleteكيفية كشف شركات التداول النصابة في العراق بكل سهولة؟
ReplyDelete