Cpp viva
Cpp viva
1. It includes the app_bar_main.xml layout (which contains the toolbar and tabs),
• Author name,
• Date of publishing,
• A share button.
Viva Tips:
Sir, include allows us to reuse an existing layout file without writing it again.
• Know the purpose of elements like CardView, Toolbar, ViewPager — they are used to
enhance the UI experience.
2. app_bar_main.xml
What to say in Viva:
Sir, this file defines the top section of the app. It uses a CoordinatorLayout to manage scrolling
behavior between components. Inside it:
• There’s an AppBarLayout which holds the Toolbar (top action bar) and a TabLayout (for
category tabs).
• Below that, it includes the layout from content_main.xml, which shows the main page
content.
Purpose: It controls the top UI (toolbar and tabs) and coordinates scrolling with content.
3. content_main.xml
What to say in Viva:
Sir, this layout manages the swipeable content inside each tab. I have used a ViewPager to allow
swiping between fragments. Inside the ViewPager, I placed a FrameLayout with the ID content_frame
to load each page dynamically.
Purpose: Enables page swiping between categories like “World”, “Tech”, etc., using ViewPager.
4. fragment_home.xml
What to say in Viva:
Sir, this layout shows the actual news content of a single tab. It uses:
• A SwipeRefreshLayout for pull-to-refresh functionality.
• A custom EmptyRecyclerView to show the list of news articles.
• A TextView that appears when no data is available.
• A ProgressBar to show loading before the news is fetched.
Purpose: Displays a list of news articles, handles refresh, and manages loading/empty states.
5. nav_header_main.xml
What to say in Viva:
Sir, this layout is the header section of the side drawer. It uses a LinearLayout with some padding
and background image. Inside, there's a TextView that displays the app name "The Guardian" in bold
and large font.
Purpose: Provides a visually appealing header for the navigation drawer.
6. news_card_item.xml
What to say in Viva:
Sir, this layout shows how a single news article appears in the list. I used a CardView to give it a clean
card-style look. Inside the card:
• There’s a title, section, and short description.
• An image thumbnail is shown on the right.
• Author and date information is included at the bottom.
• A share icon is placed for sharing the news.
Purpose: Defines how each article item looks in the RecyclerView (like a custom list item design).
7. settings_activity.xml
What to say in Viva:
Sir, this layout loads the settings page using a fragment. The fragment class is
NewsPreferenceFragment. It displays options like selecting news categories, number of items, sorting
order, etc.
Purpose: Displays the app's preferences/settings using a fragment inside the settings activity.