Google cardBoard Android API (一):CardboardActivity

public class CardboardActivity

Base activity that provides easy integration with Cardboard devices.

Exposes events to interact with Cardboards and handles many of the details commonly required when creating an Activity for VR rendering.

Public Constructors

CardboardActivity()

Public Methods

CardboardView
getCardboardView()
synchronized boolean
getConvertTapIntoTrigger()
void
onCardboardTrigger()
void
setCardboardView( CardboardView cardboardView)
synchronized void
setConvertTapIntoTrigger(boolean enabled)

Protected Methods

void
updateCardboardDeviceParams( CardboardDeviceParams newParams)

Inherited Methods

Public Constructors

public CardboardActivity ()

Public Methods

public CardboardView getCardboardView ()

Returns the Cardboard view associated with this activity.

Returns
  • The CardboardView object associated with this activity. Can be null.

public synchronized boolean getConvertTapIntoTrigger ()

Returns whether single screen taps are converted to Cardboard trigger events.

Returns
  • whether single screen taps are converted to Cardboard trigger events.

public void onCardboardTrigger ()

Override to detect when the Cardboard trigger was pulled and released.

Provides click-like events when the device is inside a Cardboard.

public void setCardboardView (CardboardView cardboardView)

Associates a Cardboard view with this activity.

This method does not set or change the content view, but associates the activity with aCardboardView and ensures it receives any required activity lifecycle notifications.

This is automatically done if setContentView is used to directly set a CardboardViewobject. Should be called if the CardboardView is set in any other way (e.g. from a layout resource).

Parameters
cardboardView The Cardboard view to associate with. Can be null.

public synchronized void setConvertTapIntoTrigger (boolean enabled)

Sets whether single screen taps should be converted to Cardboard trigger events.

If this is true, a single tap on the phone screen will result in a call toonCardboardTrigger. This is enabled by default.

Parameters
enabled whether screen taps should be converted to Cardboard trigger events.

Protected Methods

protected void updateCardboardDeviceParams (CardboardDeviceParams newParams)

Requests an update of the parameters for the current Cardboard device.

Compares against existing configuration and updates if the new parameters differ.

This method requires a CardboardView to be already set. See setCardboardView.

Parameters
newParams New Cardboard device params to set.
   
   
   
   

你可能感兴趣的:(Google cardBoard Android API (一):CardboardActivity)