Lo que trato es pasar de un fragmento a otro cuando se pulsa un botón, el código que estoy utilizando es:
public class DimensionFragment extends Fragment {
Button Bmeters,
Bfeet;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
//return inflater.inflate(R.layout.fragment_dimension, container, false);
View view = inflater.inflate(R.layout.fragment_dimension, container, false);
Bmeters = (Button) view.findViewById(R.id.buttonmeters);
Bmeters.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent Bmeters = new Intent( getActivity() ,Meters.class);
startActivity(Bmeters);
}
});
Bfeet=(Button)view.findViewById(R.id.buttonfeet);
return view;
}
Pero me sale el siguiente error cuando ejecuto
04-26 12:06:04.705 3879-3879/com.example.liantonypozo.calculosmatematicos3 E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.liantonypozo.calculosmatematicos3, PID: 3879 android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.liantonypozo.calculosmatematicos3/com.example.liantonypozo.calculosmatematicos3.DimensionFragment}; have you declared this activity in your AndroidManifest.xml? at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1805) at android.app.Instrumentation.execStartActivity(Instrumentation.java:1523) at android.app.Activity.startActivityForResult(Activity.java:4225) at android.support.v4.app.BaseFragmentActivityJB.startActivityForResult(BaseFragmentActivityJB.java:50) at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:79) at android.support.v4.app.ActivityCompatJB.startActivityForResult(ActivityCompatJB.java:30) at android.support.v4.app.ActivityCompat.startActivityForResult(ActivityCompat.java:146) at android.support.v4.app.FragmentActivity.startActivityFromFragment(FragmentActivity.java:932) at android.support.v4.app.FragmentActivity$HostCallbacks.onStartActivityFromFragment(FragmentActivity.java:1047) at android.support.v4.app.Fragment.startActivity(Fragment.java:940) at android.support.v4.app.Fragment.startActivity(Fragment.java:929) at com.example.liantonypozo.calculosmatematicos3.Fragmen2$2.onClick(Fragmen2.java:52) at android.view.View.performClick(View.java:5637) at android.view.View$PerformClick.run(View.java:22429) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6119) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)