This shows you the differences between two versions of the page.
dapm:laboratoare:07 [2018/04/13 14:23] ioana_maria.culic |
dapm:laboratoare:07 [2020/03/30 00:38] (current) sabina.horincar [Who does not respect the instructions won't receive a grade for the lab.] |
||
---|---|---|---|
Line 28: | Line 28: | ||
If an activity stops, its fragments are also stopped. If an activity is destroyed, its fragments are also destroyed.\\ | If an activity stops, its fragments are also stopped. If an activity is destroyed, its fragments are also destroyed.\\ | ||
__Method + Description__ : | __Method + Description__ : | ||
- | - onAttach() : The fragment instance is associated with an activity instance.The fragment and the activity is not fully initialized. Typically you get in this method a reference to the activity which uses the fragment for further initialization work. | + | - onAttach() : Called when the fragment has been associated with the activity (the Activity is passed in here) |
- onCreate() : Fragment is created. The onCreate() method is called after the onCreate() method of the activity but before the onCreateView() method of the fragment. | - onCreate() : Fragment is created. The onCreate() method is called after the onCreate() method of the activity but before the onCreateView() method of the fragment. | ||
- | - onCreateView() : The fragment instance creates its view hierarchy. In the onCreateView() method the fragment creates its user interface. Here you can inflate a layout via the inflate() method call of the Inflator object passed as a parameter to this method. | + | - onCreateView() : Called to create the view hierarchy associated with the fragment. |
- | - onActivityCreated() : The onActivityCreated() is called after the onCreateView() method when the host activity is created. | + | - onActivityCreated() : Called when the activity's onCreate() method has returned. |
- onStart() : The onStart() method is called once the fragment gets visible. | - onStart() : The onStart() method is called once the fragment gets visible. | ||
- onResume() : Fragment becomes active. | - onResume() : Fragment becomes active. | ||
- onPause() : Fragment is visible but becomes not active anymore, e.g., if another activity is animating on top of the activity which contains the fragment. | - onPause() : Fragment is visible but becomes not active anymore, e.g., if another activity is animating on top of the activity which contains the fragment. | ||
- onStop() : Fragment becomes not visible. | - onStop() : Fragment becomes not visible. | ||
- | - onDestroyView() : Destroys the view of the fragment. If the fragment is recreated from the backstack this method is called and afterwards the onCreateView method. | + | - onDestroyView() : Destroys the view of the fragment. If the fragment is recreated from the backstack this method is called and afterwards the onCreateView method.Called when the view hierarchy associated with the fragment is being removed. |
- onDestroy() : Not guaranteed to be called by the Android platform. | - onDestroy() : Not guaranteed to be called by the Android platform. | ||
+ | - onDetach() : Called when the fragment is being disassociated from the activity. | ||
\\ | \\ | ||
Line 130: | Line 131: | ||
====== Exercises : ====== | ====== Exercises : ====== | ||
+ | ==== Attention, for this lab you will NOT work in TEAMS!!==== | ||
+ | ==== Who does not respect the instructions won't receive a grade for the lab. ==== | ||
+ | ==Follow the following instructions: == | ||
+ | ==- For the students who do NOT have a laptop with Android Studio: == | ||
+ | Create a document describing in your OWN words the following information: \\ | ||
+ | **Ex 1 ** What are fragments? \\ | ||
+ | **Ex 2 ** Advantages and disadvantages of using fragments.\\ | ||
+ | **Ex 3 ** Explain in which conditions would you use fragments in an mobile application.\\ | ||
+ | **Ex 4 ** Find 2 tutorials that use fragments, explain them in a few words and attach the links in the document.\\ | ||
+ | |||
+ | **Attention!!** The document has to contain 1-page minimum (minimum 300 words, single-spaced, font 11pt).\\ | ||
+ | Convert it to PDF and send it via email to //**sabina.horincar@gmail.com**// specifying the name and the group. | ||
+ | |||
+ | ==- For the ones who have a laptop with Android Studio: == | ||
+ | |||
**Ex 1 ** Create an app that has 2 buttons:\\ | **Ex 1 ** Create an app that has 2 buttons:\\ | ||
- | -"Tap to Open Mic" button, to make speech to text converter\\ | + | -"Tap to Open Mic" button, to make a speech to text converter\\ |
- | -"Listen it" button, to convert the Text-To-Speech\\ | + | -"Listen" button, to convert the Text-To-Speech\\ |
\\ | \\ | ||
{{:dapm:laboratoare:lab7_ex1.jpg?200|}} | {{:dapm:laboratoare:lab7_ex1.jpg?200|}} | ||
{{:dapm:laboratoare:lab7_ex11.jpg?200|}} | {{:dapm:laboratoare:lab7_ex11.jpg?200|}} | ||
+ | \\ | ||
+ | **Ex 2** https://examples.javacodegeeks.com/android/core/app/fragment/android-fragments-example/ | ||
+ | \\ | ||
+ | **Ex 3** Upload the project on Github and write a README file explaining in minimum 100 words the exercises, what you've learned from them, the problems that you had, and don't forget to include a VIDEO of the applications. | ||
+ | \\ | ||
+ | |||
+ | **Attention!! Only the person who owns the Github page will receive the grade of the lab** |