diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-02-13 22:15:10 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2016-11-10 17:40:55 +0100 |
commit | aa33f187990a0858de0252c96a695d984ba9b924 (patch) | |
tree | 91af28db188e57b41e7e8df19df95d6a0fe82392 /Android/04-TheFragmentClass/FragmentsLab/src/course/labs/fragmentslab/FeedFragment.java | |
parent | f14e5dbbdf84a5bc068e3a1cfd104e876dd6da61 (diff) | |
download | coursera-aa33f187990a0858de0252c96a695d984ba9b924.zip coursera-aa33f187990a0858de0252c96a695d984ba9b924.tar.gz |
Android : 04-TheFragmentClass: add
Diffstat (limited to 'Android/04-TheFragmentClass/FragmentsLab/src/course/labs/fragmentslab/FeedFragment.java')
-rw-r--r-- | Android/04-TheFragmentClass/FragmentsLab/src/course/labs/fragmentslab/FeedFragment.java | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/Android/04-TheFragmentClass/FragmentsLab/src/course/labs/fragmentslab/FeedFragment.java b/Android/04-TheFragmentClass/FragmentsLab/src/course/labs/fragmentslab/FeedFragment.java new file mode 100644 index 0000000..50562a1 --- /dev/null +++ b/Android/04-TheFragmentClass/FragmentsLab/src/course/labs/fragmentslab/FeedFragment.java @@ -0,0 +1,38 @@ +package course.labs.fragmentslab; + +import android.app.Fragment; +import android.os.Bundle; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +public class FeedFragment extends Fragment { + + private static final String TAG = "Lab-Fragments"; + + private TextView mTextView; + private static FeedFragmentData feedFragmentData; + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + return inflater.inflate(R.layout.feed, container, false); + } + + @Override + public void onActivityCreated(Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + // Read in all Twitter feeds + if (null == feedFragmentData) { + feedFragmentData = new FeedFragmentData(getActivity()); + } + } + + // Display Twitter feed for selected feed + void updateFeedDisplay(int position) { + Log.i(TAG, "Entered updateFeedDisplay()"); + mTextView = (TextView) getView().findViewById(R.id.feed_view); + mTextView.setText(feedFragmentData.getFeed(position)); + } +} |