I have a first class extending Fragment, and a second class extending Activity.
My Fragment is working fine, and my code for the Intent in the Fragment is :
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); }
});
My class MyClass code is :
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);
}
}
The error is :
Gradle: cannot find symbol constructor Intent(com.xxxx.xxxx.MyFragment,java.lang.Class<com.xxxx.xxxx.MyClass>)
I don't know where I went wrong.