2011-08-01 9 views
0

신참 ...안드로이드 탭 레이아웃 오류

는 둘 다 배우고 (here를 볼 때)하지만 몇 가지 오류를 가로 질러 온 갤럭시 탭 레이아웃 작업을 진행하기 위해 노력하고있어. 모든는 다음을 제외 해결되었습니다 : [. ArtistsActivity이 유형에 해결 될 수없는]

난 다음 그것을 얻을 :

ArtistsActivity.class 
AlbumsActivity.class 
SongsActivity.class 

가 어떻게이 문제를 해결합니까?

도움 주셔서 감사합니다.

는 (자바 클래스에 대한이 가을 학기를 등록 간다.)

HelloTabWidget.java이

package com.HelloTabWidget.tabs; 
import android.app.TabActivity; 
import android.content.Intent; 
import android.content.res.Resources; 
import android.os.Bundle; 
import android.widget.TabHost; 



public class HelloTabWidget extends TabActivity { 
    /** Called when the activity is first created. */ 
    @Override 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.main); 

     Resources res = getResources(); // Resource object to get Drawables 
     TabHost tabHost = getTabHost(); // The activity TabHost 
     TabHost.TabSpec spec; // Resusable 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, ArtistsActivity.class); 

     // Initialize a TabSpec for each tab and add it to the TabHost 
     spec = tabHost.newTabSpec("artists").setIndicator("Artists", 
          res.getDrawable(R.drawable.ic_tab_artists)) 
         .setContent(intent); 
     tabHost.addTab(spec); 

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

     intent = new Intent().setClass(this, SongsActivity.class); 
     spec = tabHost.newTabSpec("songs").setIndicator("Songs", 
          res.getDrawable(R.drawable.ic_tab_artists)) 
         .setContent(intent); 
     tabHost.addTab(spec); 

     tabHost.setCurrentTab(2); 
    } 
}  
+0

를 호출 –

답변

1

이 같은 시도 먼저 오류가 무엇 의도 장소

Intent showContent = new Intent(getApplicationContext(),ArtistsActivity.class); 
    startActivity(showContent); 
관련 문제