posts • User can pull to refresh the most recent 20 posts • The user can switch between different tabs - viewing all posts (feed) - capture (creation) - profile tabs (stream)
with the new fragment getSupportFragmentManager() .beginTransaction() .replace(R.id.flContainer, new FooFragment()) .commit(); <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity" > <FrameLayout android:id="@+id/flContainer" android:layout_width="match_parent" android:layout_height="match_parent"/> </RelativeLayout> activity_main.xml MainActivity.java
Java class + XML file has their own lifecycle callbacks must live in an Activity When Activities contain Fragments, the Activity controls which Fragment to show. The rest of the logic goes in the Fragment (setting up views, handling clicks, making network calls…)