O'Reilly logo

Android™ 6 for Programmers: An App-Driven Approach, Third Edition by Alexander Wald, Harvey Deitel, Paul Deitel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

4.7 MainActivityFragment Class

Class MainActivityFragment (Figs. 4.324.42)—a subclass of the Android Support Library’s Fragment class (package android.support.v4.app)—builds the Flag Quiz’s GUI and implements the quiz’s logic.

 1   // MainActivityFragment.java  2   // Contains the Flag Quiz logic  3   package com.deitel.flagquiz;  4  5   import java.io.IOException;  6   import java.io.InputStream;  7   import java.security.SecureRandom;  8   import java.util.ArrayList;    9   import java.util.Collections; 10   import java.util.List;        11   import java.util.Set;         12 13   import android.animation.Animator;                14   import android.animation.AnimatorListenerAdapter; 15   import android.app.AlertDialog;                   ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required