Tuesday, December 2, 2014

Using fragment below honeycomb / Fragment below honeycomb or 3.0

1. Go to “Android SDK Manager” => “Extras” =>”Android Support package” and select and install it.
2. There are multiple ways to add and use the Android support Package into project 
i. Adding jar directly in project
ii. Referencing the library from project. (This option is best because  it is more portable because if you are working with multiple developers then do not have to worry about who has what version of support package.
To implement above (ii) approach go to file explorer got to sdk home then => “android-sdk” => “extras”=> “android” =>”support” under this folder you will find folder with respect to the android version to support it.
ex:- have folder v4 means support 1.4 . Go into the folder copy the .jar file  and add to project ,Normally create a folder (any name but lib is preferable) and jar to it. Then when go to eclipse refresh/F5 to make lib visible in project.
After making the jar visible in the eclipse right click on jar file then => “Build path” => “Add to build path”. After this you will be able to see the jar under the referenced library.

From Honecomb onwards the activity is activity is updated to working with the fragment manager. There is class FragmentActivity in support sdk which will help for fragment in below version.
To get FragmentManager there is method getSupportFragmentManager() (in honeycomb and above the method in which  no support keyword i.e. getFragmentManager() ) which returns the object of FragmentManager class.



No comments:

Post a Comment