public class MainFragment extends Fragment { private static final String TAG = MainFragment.class.getSimpleName();
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log.d(TAG, "onCreateView");
View rootView = inflater.inflate(R.layout.fragment_main, container, false);
View finish = rootView.findViewById(R.id.finish); finish.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { getActivity().finish(); } });
View withoutReturn = rootView.findViewById(R.id.withoutReturn); withoutReturn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(getActivity(), Sub.class); startActivity(intent); } });
View withReturn = rootView.findViewById(R.id.withReturn); withReturn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(getActivity(), Sub.class); startActivityForResult(intent, 10); } });
return rootView; }
@Override public void onHiddenChanged(boolean hidden) { Log.d(TAG, "onHiddenChanged"); super.onHiddenChanged(hidden); }
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { Log.d(TAG, "onActivityResult, requestCode: " + requestCode + " , resultCode: " + resultCode); super.onActivityResult(requestCode, resultCode, data); }
@Override public void onAttach(Activity activity) { Log.d(TAG, "onAttach"); super.onAttach(activity); }
@Override public void onCreate(Bundle savedInstanceState) { Log.d(TAG, "onCreate"); super.onCreate(savedInstanceState); }
@Override public void onViewCreated(View view, Bundle savedInstanceState) { Log.d(TAG, "onViewCreated"); super.onViewCreated(view, savedInstanceState); }
@Override public void onActivityCreated(Bundle savedInstanceState) { Log.d(TAG, "onActivityCreated"); super.onActivityCreated(savedInstanceState); }
@Override public void onStart() { Log.d(TAG, "onStart"); super.onStart(); }
@Override public void onResume() { Log.d(TAG, "onResume"); super.onResume(); }
@Override public void onViewStateRestored(Bundle savedInstanceState) { Log.d(TAG, "onViewStateRestored"); super.onViewStateRestored(savedInstanceState); }
@Override public void onSaveInstanceState(Bundle outState) { Log.d(TAG, "onSaveInstanceState"); super.onSaveInstanceState(outState); }
@Override public void onConfigurationChanged(Configuration newConfig) { Log.d(TAG, "onConfigurationChanged"); super.onConfigurationChanged(newConfig); }
@Override public void onPause() { Log.d(TAG, "onPause"); super.onPause(); }
@Override public void onStop() { Log.d(TAG, "onStop"); super.onStop(); }
@Override public void onDestroyView() { Log.d(TAG, "onDestroyView"); super.onDestroyView(); }
@Override public void onDestroy() { Log.d(TAG, "onDestroy"); super.onDestroy(); }
@Override public void onDetach() { Log.d(TAG, "onDetach"); super.onDetach(); }
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { Log.d(TAG, "onCreateOptionsMenu"); super.onCreateOptionsMenu(menu, inflater); }
@Override public void onPrepareOptionsMenu(Menu menu) { Log.d(TAG, "onPrepareOptionsMenu"); super.onPrepareOptionsMenu(menu); }
@Override public void onDestroyOptionsMenu() { Log.d(TAG, "onDestroyOptionsMenu"); super.onDestroyOptionsMenu(); }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { Log.d(TAG, "onCreateContextMenu"); super.onCreateContextMenu(menu, v, menuInfo); } }
|