- tabHost = getTabHost();
- tabHost.getTabWidget().setDividerDrawable(R.drawable.tab_divider);
- indicatorview1 = android.view.LayoutInflater.from(this).inflate(R.layout.tabs_bg_styled, null);
- first=tabHost.newTabSpec("Tab 1");
- ((TextView)indicatorview1.findViewById(R.id.tabsText)).setText("");
- first.setIndicator(indicatorview1);
- Intent in1=new Intent(getBaseContext(),com.Orange.MakeVisits.FakeActivity.class);
- first.setContent(in1);
- indicatorview2 = android.view.LayoutInflater.from(this).inflate(R.layout.tabs_bg_styled, null);
- second=tabHost.newTabSpec("Tab 2");
- ((TextView)indicatorview2.findViewById(R.id.tabsText)).setText("Personal");
- second.setIndicator(indicatorview2);
- Intent in2 = new Intent(this, Personnal.class);
- second.setContent(in2);
- indicatorview3 = android.view.LayoutInflater.from(this).inflate(R.layout.tabs_bg_styled, null);
- third=tabHost.newTabSpec("Tab 3");
- ((TextView)indicatorview3.findViewById(R.id.tabsText)).setText("Settings");
- third.setIndicator(indicatorview3);
- Intent in3 = new Intent(this, Settings.class);
- third.setContent(in3);
- indicatorview4 = android.view.LayoutInflater.from(this).inflate(R.layout.tabs_bg_styled, null);
- fourth=tabHost.newTabSpec("Tab 4");
- ((TextView)indicatorview4.findViewById(R.id.tabsText)).setText("");
- fourth.setIndicator(indicatorview4);
- Intent in4 = new Intent(this, Settings.class); ??
- fourth.setContent(in4); ??
- tabHost.addTab(first);
- tabHost.addTab(second);
- tabHost.addTab(third);
- tabHost.addTab(fourth);
- tabHost.setOnTabChangedListener(new OnTabChangeListener(){
- public void onTabChanged(String tabId) {
- if(TAB_1_TAG.equals(tabId)) {
- finish();
- }
- if (tabId.equals("Tab 4")){
- System.out.println("44444");
- View v = tabHost.getCurrentView();
- registerForContextMenu(v);
- v.showContextMenu();
- }
- }});
- tabHost.setCurrentTab(1);
- }
- @Override
- public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
- super.onCreateContextMenu(menu, v, menuInfo);
- MenuInflater inflater = getMenuInflater();
- inflater.inflate(com.Orange.R.menu.context_menu, menu);
- }
- @Override
- public boolean onContextItemSelected(MenuItem item) {
- AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
- Toast.makeText(this, "You have chosen the context menu option ",Toast.LENGTH_SHORT).show();
- return true;
- }