Android Create Intent In Fragment

When working with Fragment if you have any links which forward the user to another Activity you have to change the source parameter to “fa”. For further information on fa take a look at this. This will look like this: Intent explicitIntent = new Intent(fa, AuthorInformation.class); startActivity(explicitIntent); Previous step.

Android Convert onCreate() to Fragment

onCreate() is mandatory for both an Activity and Fragment. They differ a bit. To see how to change your Activity to a Fragment take a look at the previous step. Before: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.outer_layout); } After: private LinearLayout ll; private FragmentActivity fa; public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { fa

Read More

Android Fragment Save States Of Views

To save the Fragment state in Android you can do this. First save the state: @Override     public void onSaveInstanceState(Bundle outState) {         super.onSaveInstanceState(outState);         outState.putInt(“curChoice”, mCurCheckPosition);     } And later use it: @Override     public void onActivityCreated(Bundle savedInstanceState) {         super.onActivityCreated(savedInstanceState);  

Read More