Label: Arcolepsy Records - ARMB01,Mathbat Records - ARMB01 • Format: CDr • Country: Canada • Genre: Electronic • Style: Tribal, Abstract, Experimental
The purpose of this sample is two-fold: to demonstrate switching between one Fragment when in portrait orientation and two Fragments when in landscape orientation and to demonstrate use of Fragment. It displays a list of basemaps, then displays a map containing the selected basemap plus 3 feature layers.
In portrait orientation the map takes up the whole screen and you must Fragment - ARC - Two the Back key or the Home button on the action bar to return to the list. But in landscape orientation the list and the map are displayed side by side. The MapView has Fragment - ARC - Two be recreated when orientation changes, but the objects containing the map layers are retained so data does not need to be fetched from the network again.
This sample has one activity, FragmentManagementActivityHerb Alperts Tijuana Brass* - Whipped Cream & Other Delights is responsible for creating and managing two fragments, one to display the list of basemaps and the other to display the map.
It sets the content view to R. The activity initially places a list fragment in it, then replaces it by a map fragment when a basemap is selected. This is replaced by the list fragment again when the map is dismissed, but the map fragment is retained for future use. When orientation changes, the activity is destroyed and onCreate is called again.
BasemapListFragment extends ListFragment and presents a list of basemaps. The host activity passes in an integer argument being the currently selected position in the list. This is used to highlight the current basemap when in two-pane mode.
The activity must also implement a BasemapListListener interface consisting of an onBasemapSelected method that is called when a basemap is selected. MapFragment extends Fragment and displays map layers in a MapView. The host activity passes in a String argument being the name of the basemap to use. The onCreate method calls setRetainInstance true which causes the fragment instance to be retained when the Activity is destroyed Fragment - ARC - Two recreated.
This allows map Layer objects to be retained when the orientation changes. The onCreateView method always creates a new MapView object, because any old MapView would be tied to an old Activity that has been destroyed, but it reuses existing Layer objects if any so the data they contain will not need to be fetched from the network again.
A public method changeBasemap is used by the activity to update the basemap when a new one is selected from the list when in two-pane mode. Return - Gridlock - Formless SDK Sample Design FragmentManagementActivity This Fragment - ARC - Two has one activity, FragmentManagementActivitywhich is responsible for creating and managing two fragments, one to display the list of basemaps and the other to display the map.
The activity acts upon the following UI events: Selection of a basemap from the list is handled by onBasemapSelected. It is passed on to the map fragment and the map fragment is displayed if it's not already on screen. A press on the Fragment - ARC - Two button in the action bar is handled by onOptionsItemSelected. This causes return from map fragment to list fragment when in single-pane mode.
A press on the Back key is handled by onBackPressed. This causes return from map fragment to list fragment when in single-pane mode, or finishes the activity if the list fragment was already displayed. Sample Code FragmentManagementActivity. Activity; import android. FragmentManager; import android. Bundle; import android. MenuItem; import com.
Fragment; import android. LayoutInflater; import android. View; import android. ViewGroup; import com. MapView; import com. Envelope; import com. GeometryEngine; import com. Point; import com. Displays a basemap layer and a number of feature layers in a MapView.
ListFragment; Border Song - Elton John - Early Session - Lost BBC & Live android.
AbsListView; import android. AdapterView; import android. ArrayAdapter; import android. ListView; import android. When this mode is on, list items will be given the 'activated' state when touched.