mercredi 25 février 2015

Android Fragment Tab compilation error



I got a very odd problem. I need to create a three tabs in my activiy. Eveything seems fine, but I got the only ine mistake on the same line everytime no matter is it a part if the code either a comment. Here is the code



package com.example.i.actionbar4;

import android.app.ActionBar;
import android.graphics.drawable.Drawable;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTabHost;


public class MainActivity extends FragmentActivity {
// start
private FragmentTabHost mTabHost;
// end
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// start
mTabHost = (FragmentTabHost) findViewById(android.R.id.tabhost);
// Error always there mTabHost.setup(this, getSupportFragmentManager(), android.R.id.tabcontent);
mTabHost.addTab(
mTabHost.newTabSpec("tab1").setIndicator("Tab 1", null),
FragmentTab.class, null);
mTabHost.addTab(
mTabHost.newTabSpec("tab2").setIndicator("Tab 2", null),
FragmentTab.class, null);
mTabHost.addTab(
mTabHost.newTabSpec("tab3").setIndicator("Tab 3", null),
FragmentTab.class, null);
}
//end



Aucun commentaire:

Enregistrer un commentaire