Click here to Skip to main content
15,891,316 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am trying to create tabs in an android app, and i am doing a tutorial which is found in here

http://developer.android.com/resources/tutorials/views/hello-tabwidget.html[^]

but unknow the TabActivity and take this solution: @SuppressWarnings("deprecation")!!
?
Java
<code>
import android.app.TabActivity; //  - This is crossed in the middle
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;
 
public class DemonstratorActivity extends TabActivity {
 
	 public void onCreate(Bundle savedInstanceState) {
	        super.onCreate(savedInstanceState);
	        setContentView(R.layout.main);
 
	        Resources res = getResources(); 
	        TabHost tabHost = getTabHost();  // The activity TabHost - This is crossed in the middle
	        TabHost.TabSpec spec; 
	        Intent intent;  
 
	        // Create an Intent to launch an Activity for the tab (to be reused)
	        intent = new Intent().setClass(this, DriveActivity.class);
 
	        // Initialize a TabSpec for each tab and add it to the TabHost
	        spec = tabHost.newTabSpec("Tab1").setIndicator("Tab1",
	                          res.getDrawable(R.drawable.Tab1picture))
	                      .setContent(intent);
	        tabHost.addTab(spec);
 
	        // Do the same for the other tabs
	        intent = new Intent().setClass(this, LightsControlActivity.class);
	        spec = tabHost.newTabSpec("Tab2").setIndicator("Tab2",
	                          res.getDrawable(R.drawable.Tab2picture))
	                      .setContent(intent);
	        tabHost.addTab(spec);
 
	        intent = new Intent().setClass(this, NavigationActivity.class);
	        spec = tabHost.newTabSpec("Tab3").setIndicator("Tab3",
	                          res.getDrawable(R.drawable.Tab3picture))
	                      .setContent(intent);
	        tabHost.addTab(spec);
 
	        tabHost.setCurrentTab(2);
	    }
	}</code>
Posted
Updated 1-Aug-13 10:26am
v2

1 solution

It's not actually an issue. It's just a warning telling you that the object you are using has already been deprecated. It does not mean that you cannot use the object anymore.
 
Share this answer
 
Comments
moosa il 2-Aug-13 4:08am    
don't execute the program.
walterhevedeich 2-Aug-13 9:55am    
not sure what you mean by that.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900