Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so dont bother with any of their useless mail servers here and just use oauth login instead. Thank the nice Russians for causing that. :)

Paste

Pasted as Java by registered user neetika ( 14 years ago )
package com.live2support;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.util.Log;
import android.widget.TabHost;

public class L2STest extends TabActivity {
 /** Called when the activity is first created. */

 TabHost.TabSpec spec; // Resusable TabSpec for each tab
 public static TabHost tabHost;
 public static BadgeTabWidget tabWidget;
 int num;
 Intent intent; // Reusable Intent for each tab

 @Override
 public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.l2s);

  Resources res = getResources(); // Resource object to get Drawables
 // The activity TabHost
  BadgeTabWidget tabWidget = (BadgeTabWidget) this
    .findViewById(android.R.id.tabs);
  BadgeTabManager.init(tabWidget);
  tabHost = getTabHost(); 


  // Create an Intent to launch an Activity for the tab (to be reused)
  intent = new Intent().setClass(this, BaseActivity.class);

  // Initialize a TabSpec for each tab and add it to the TabHost
  try {
   spec = tabHost
     .newTabSpec("Live2Support")
     .setIndicator("Live2Support",
       res.getDrawable(R.drawable.icon))
     .setContent(intent);
   try{
    
    if(tabHost==null)
     Log.d("null","null"); 
    if(spec== null)
     Log.d(" spec null","null"); 
   tabHost.addTab(spec);
   }catch(Exception e){
    e.printStackTrace();
   }
  } catch (RuntimeException e) {
   e.printStackTrace();
  }
  

  // Do the same for the other tabs
  intent = new Intent().setClass(this, MultiChat.class);
  spec = tabHost.newTabSpec("Chats")
    .setIndicator("Chats", res.getDrawable(R.drawable.g_chat1))
    .setContent(intent);
  tabHost.addTab(spec);

  intent = new Intent().setClass(this, OperatorList.class);
  spec = tabHost.newTabSpec("Operators")
    .setIndicator("Operators", res.getDrawable(R.drawable.opp2))
    .setContent(intent);
  tabHost.addTab(spec);

  intent = new Intent().setClass(this, Controls.class);
  spec = tabHost.newTabSpec("Controls")
    .setIndicator("Controls", res.getDrawable(R.drawable.box))
    .setContent(intent);
  tabHost.addTab(spec);

  tabHost.setCurrentTab(0);

  
  //   BadgeTabManager.getInstance().setBadgeAtIndex(MultiChat.noofchats, 1);

  //BadgeTabManager.getInstance().setBadgeAtIndex(BaseActivity.num, 0);
  BadgeTabManager.getInstance().setBadgeAtIndex(0, 1);

  BadgeTabManager.getInstance().setBadgeAtIndex(0, 0);
  
  

  // tabHost.getTabWidget().getChildTabViewAt(1).setEnabled(false);
 }
}

 

Revise this Paste

Your Name: Code Language: