I was trying to go to another page using button
, but it always fail.
Here is my First Class with its XML:
public class Fin
Remove this
android:onClick="goToAttract"
Then
View rootView = inflater.inflate(R.layout.fragment_home, container, false);
Button b = (Button)rootView.findViewById(R.id.button1);
b.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
Intent intent = new Intent(getActivity(), MainActivityList.class);
startActivity(intent);
}
});
return rootView;
The error says you need to public void goToAttract(View v)
in Activity class
Could not find method goToAttract(View) in the activity class
Reason pls check the answer by PareshMayani @
Android app crashing (fragment and xml onclick)
Edit:
Caused by: java.lang.OutOfMemoryError
I guess you have a image that is too big to fit in and it needs to be scaled down. Hence the OutOfMemoryError
.