This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<activity | |
android:name=".MyActivity" | |
android:label="@string/title_my_activity" | |
android:configChanges="orientation|screenSize|keyboardHidden" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<activity | |
android:name=".MyActivity" | |
android:label="@string/title_my_activity" | |
android:screenOrientation="portrait" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static final String STATE_COUNTER = "counter"; | |
private int mCounter; | |
... | |
@Override | |
protected void onSaveInstanceState(Bundle outState) { | |
// Make sure to call the super method so that the states of our views are saved | |
super.onSaveInstanceState(outState); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static final String STATE_COUNTER = "counter"; | |
private TextView mCounterTextView; | |
private int mCounter; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static final String STATE_ITEMS = "items"; | |
// Make sure to declare as ArrayList so it's Serializable | |
private ArrayList<Item> mItems; | |
... | |
@Override | |
protected void onSaveInstanceState(Bundle outState) { | |
// Make sure to call the super method so that the states of our views are saved |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static final String STATE_ID = "id"; | |
private static final String STATE_ITEMS = "items"; | |
private long mId; | |
private ArrayList<Item> mItems; | |
private ListView mListView; | |
private ArrayAdapter<Item> mAdapter; | |
@Override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static final String TAG_MY_FRAGMENT = "myFragment"; | |
private MyFragment mFragment; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_adding_fragments); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static final String STATE_TASK_RUNNING = "taskRunning"; | |
private MyTask mTask; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(...); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private Subscription mDoSomethingSubscription; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(...); | |
// Setup views | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class NetworkRequestFragment extends Fragment { | |
// Declare some sort of interface that your AsyncTask will use to communicate with the Activity | |
public interface NetworkRequestListener { | |
void onRequestStarted(); | |
void onRequestProgressUpdate(int progress); | |
void onRequestFinished(SomeObject result); | |
} | |
private NetworkTask mTask; |
OlderNewer