本文整理汇总了Java中com.thalmic.myo.Hub.init方法的典型用法代码示例。如果您正苦于以下问题:Java Hub.init方法的具体用法?Java Hub.init怎么用?Java Hub.init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.thalmic.myo.Hub
的用法示例。
在下文中一共展示了Hub.init方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: connect
import com.thalmic.myo.Hub; //导入方法依赖的package包/类
@Override
public boolean connect() throws Exception {
Log.d("", "preConnect");
super.connect();
// First, we initialize the Hub singleton with an application identifier.
Hub hub = Hub.getInstance();
if (!hub.init(mContext, mContext.getPackageName())) {
// We can't do anything with the Myo device if the Hub can't be initialized, so exit.
//Toast.makeText(this, "Couldn't initialize Hub", Toast.LENGTH_SHORT).show();
//finish();
return false;
}
// Next, register for DeviceListener callbacks.
hub.addListener(mListener);
hub.attachToAdjacentMyo();
sendConnected();
return true;
}
示例2: onCreate
import com.thalmic.myo.Hub; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mMapView = MapService.getMap(this);
Log.d("ArcGIS", "Entering MapActivity");
initGestureDetector(this);
initSensors(this);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setContentView(mMapView);
Hub hub = Hub.getInstance();
if (!hub.init(this, getPackageName())) {
// We can't do anything with the Myo device if the Hub can't be initialized, so exit.
Toast.makeText(this, "Couldn't initialize Hub", Toast.LENGTH_SHORT).show();
finish();
return;
}
mListener = new MyoMapListener(this, mMapView);
hub.addListener(mListener);
hub.setLockingPolicy(Hub.LockingPolicy.NONE);
hub.attachToAdjacentMyo();
}
示例3: onCreate
import com.thalmic.myo.Hub; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// First, we initialize the Hub singleton
final Hub hub = Hub.getInstance();
if (!hub.init(this, getPackageName())) {
// We can't do anything with the Myo device if the Hub can't be initialized, so exit.
Toast.makeText(this, "Couldn't initialize Hub", Toast.LENGTH_SHORT).show();
finish();
return;
}
hub.setLockingPolicy(Hub.LockingPolicy.NONE);
// Connects to a Myo that is physically touching the device
hub.attachToAdjacentMyo();
mMapView = new MapView(this, "http://csf.maps.arcgis.com/home/item.html?id=f065c8fa4e514749aeef57919b3d192e", null, null);
mMapView.setOnStatusChangedListener(new OnStatusChangedListener() {
@Override
public void onStatusChanged(Object source, STATUS status) {
if (source instanceof ArcGISFeatureLayer && status == STATUS.LAYER_LOADED) {
mFeatureControlListener = new MyoFeatureControlListener(MainActivity.this, mMapView, (ArcGISFeatureLayer) source);
}
}
});
mMapControlListener = new MyoMapControlListener(this, mMapView);
hub.addListener(mMapControlListener);
setContentView(mMapView);
mWearMessageListener = new WearMessageListener(mMapView);
initGoogleApiClient();
}