Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android fragment source code for FragmentLayout.java

I m trying to understand the concept of fragment on android. The official pages has some code snippets and a link mentioning the entire source code called FragementLayout.java. However on clicking it , I get redirected to this page

http://developer.android.com/tools/samples/index.html

Which says the source code is available in the samples directory where the sdk has been installed. I tried checking out samples of various different API levels (8, 11, 17) but could not find the source code for fragments tutorial. Does any body know where it is ?

like image 733
Vihaan Verma Avatar asked Nov 25 '22 15:11

Vihaan Verma


2 Answers

I have that exact file in the samples folder of 13, 14 & 16.

For extra credit, I recommend checking out the Fragments demo of Action Bar Sherlock, since I believe it shows a better way of learning Fragments.

For more discussion about this, check out my question & the related answers:

  • How many Activities vs Fragments?

You can see that I do not like the pattern in that tutorial, but there is good discussion for both approaches.

like image 74
Richard Le Mesurier Avatar answered Nov 27 '22 05:11

Richard Le Mesurier


Make a new project using create project from existing sample. Choose maximum target name then Select Sample ApiDemo. Finish. Now go to ApiDemos->src->com.example.android.apis.app->FragmentLayout.java .Enjoy

like image 21
MGDroid Avatar answered Nov 27 '22 06:11

MGDroid