构造函数intent报错 undefined

使用fragment中有一个下拉列表,我想在选择下拉列表项目时启动一个新activity。结果报错:

The constructor Intent(UserHomeActivity, Class) is undefined UserHomeActivity.java /SwipeyTabs/src/com/recscores/android line 28 Java Problem

实现代码:

public class UserHomeActivity extends SherlockFragment{

Spinner spinnerTeam;
Spinner spinnerLeague;

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
    View view =inflater.inflate(R.layout.user_home, container, false);


    // Team Spinner
    spinnerTeam = (Spinner)view.findViewById(R.id.spinner_team);
    spinnerTeam.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { 
            **Intent ii = new Intent(UserHomeActivity.this,TeamHomeActivity.class);
            startActivity(ii); **
        } 

        public void onNothingSelected(AdapterView<?> adapterView) {
            return;
        } 
    }); 

1个回答

请检查下你的UserHomeActivity 有没有在ANDROIDMANIFEST.XML中定义过,

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问