Content State Wizard

The purpose of content state wizard is to let the user define a state by which content is shared. There are enumerable ways to define the state of some object or context. Accordingly it is very possible that many apps with have their own content state wizard (see for example the newspaper ref app). Yet, content glass is provided with some basic wizards that that can be used by apps and also can be customize or possibly inherited.


The wizard provide users with simple text field where they can enter some word or phrase. When done the text is returned back to 

MyGlass and we are using this text as the 'Glass Id' property of the context state represented in code by Layer object.In our example we are using the wizard class which is very 

convenient for testing your app. To open the wizard user click the "Set sharing context"  button. 

After state is set, our app start the glass by providing a Layer object that encapsulate once single state of our context (remember that in our example we refer to some abstract context, not a specific one).  New widget are then related with the text. When widget is created it is stored in relation with the state (some text) encapsulated by layer object. 






private void setGlassForState(String glassId) { //present glassId on screen setContentInfoText(glassId); //start (or restart) the glass CGLayer layer = new CGLayer(glassId, CGFinals.GLASS_TYPE_OBJECT, null, false); getCGApplication().startContentGlass(layer); //invalidate options menu in order to enable menu items getActivity().invalidateOptionsMenu(); //ask user for creating new comment askUserForCreate(); }


If you click "Set sharing context" and define another text to represent the state, you will not see the previously created widget. If you open the wizard again and type again the original text the widget appears again. This small experiment demonstrate the concept of state oriented sharing: Widgets are shared (create and exposed) in relation with some state that represent a state of some object in the world.  Your state oriented sharing app let users share widgets of many types in relation with states of objects and things around us (either virtual, physical or physiological). 


Refer to API reference document in order to see other possible wizards that are ready to use

* Note! some wizards are currently under construcion