我有一个第一类扩展Fragment,和第二类扩展Activity。
我的Fragment工作正常,我的代码中的Intent的Fragment是:
ImageButton button= (ImageButton) getView().findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent myIntent = new Intent(MyFragment.this, MyClass.class);
MyFragment.this.startActivity(myIntent); }
});
我的类MyClass的代码是:
public class MyClass extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// The activity is being created.
}
@Override
protected void onStart() {
super.onStart();
setContentView(R.layout.MyClass);
}
}
错误是:
Gradle:找不到符号构造函数Intent(com.xxxx.xxxx.MyFragment,java.lang.Class< com.xxxx.xxxx.MyClass>)
我不知道我在哪里错了。