本文整理了Java中android.support.wearable.activity.WearableActivity.onCreate()
方法的一些代码示例,展示了WearableActivity.onCreate()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WearableActivity.onCreate()
方法的具体详情如下:
包路径:android.support.wearable.activity.WearableActivity
类名称:WearableActivity
方法名:onCreate
暂无
代码示例来源:origin: jamorham/xDrip-plus
@Override
protected void onCreate(Bundle savedInstanceState) {
Log.d(TAG, "onCreate ENTERING");
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_body_permission);
JoH.vibrateNotice();
}
代码示例来源:origin: jamorham/xDrip-plus
@Override
protected void onCreate(Bundle savedInstanceState) {
Log.d(TAG, "onCreate ENTERING");
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_location_permission);
JoH.vibrateNotice();
}
代码示例来源:origin: Calsign/APDE
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_companion);
// Display version of the wear companion
String versionName = "";
try {
versionName = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
} catch (PackageManager.NameNotFoundException e) {
// Oops
Log.d("apde", "failed to load version name, that's strange");
}
((TextView) findViewById(R.id.wear_compnanion_activity_version)).setText(versionName);
}
}
代码示例来源:origin: JimSeker/wearable
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mTextView = findViewById(R.id.text);
//send a message from the wear. This one will not have response.
myButton = findViewById(R.id.wrbutton);
myButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String message = "Hello device " + num;
//Requires a new thread to avoid blocking the UI
sendData(message);
num++;
}
});
// Enables Always-on
setAmbientEnabled();
}
代码示例来源:origin: ginkage/wearmouse
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setAmbientEnabled();
setContentView(R.layout.activity_bt_state);
registerReceiver(
bluetoothStateReceiver, new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED));
checkState(BluetoothAdapter.getDefaultAdapter().getState());
}
代码示例来源:origin: JimSeker/wearable
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setAmbientEnabled();
mContainerView = (BoxInsetLayout) findViewById(R.id.container);
mTextView = (TextView) findViewById(R.id.text);
mData = (TextView) findViewById(R.id.data);
sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
//write out to the log all the sensors the device has.
sensors = sensorManager.getSensorList(Sensor.TYPE_ALL);
if (sensors.size() < 1) {
Toast.makeText(this, "No sensors returned from getSensorList", Toast.LENGTH_SHORT).show();
Log.wtf(TAG,"No sensors returned from getSensorList");
}
Sensor[] sensorArray = sensors.toArray(new Sensor[sensors.size()]);
for (int i = 0; i < sensorArray.length; i++) {
Log.wtf(TAG,"Found sensor " + i + " " + sensorArray[i].toString());
}
}
代码示例来源:origin: JimSeker/wearable
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mTextView = findViewById(R.id.text);
//send a message from the wear. This one will not have response.
myButton = findViewById(R.id.wrbutton);
myButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String message = "Hello device " + num;
//Requires a new thread to avoid blocking the UI
new SendThread(datapath, message).start();
num++;
}
});
// Enables Always-on
setAmbientEnabled();
}
代码示例来源:origin: kevalpatel2106/android-samples
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_track);
//Set this to allow activity to enable the ambient mode
setAmbientEnabled();
//Get the watch view stub
mWatchViewStub = (WatchViewStub) findViewById(R.id.watch_view_stub);
mWatchViewStub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() {
@Override
public void onLayoutInflated(WatchViewStub watchViewStub) {
init(watchViewStub);
}
});
//Connect Google api client to communicate with phone
connectGoogleApiClient();
}
代码示例来源:origin: nglauber/dominando_android2
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_wear);
setAmbientEnabled();
String[] dados = new String[] {
"Opção 1", "Opção 2", "Opção 3", "Opção 4"
};
mAdapter = new MeuListAdapter(this, dados);
mListView = (WearableListView) findViewById(R.id.wearable_list);
mListView.setAdapter(mAdapter);
mListView.setClickListener(new WearableListView.ClickListener() {
@Override
public void onClick(WearableListView.ViewHolder viewHolder) {
int position = viewHolder.getAdapterPosition();
// Clicou em um item da lista...
if (position == 3) {
mListView.setVisibility(View.GONE);
exibirConfirmacao();
}
}
@Override
public void onTopEmptyRegionClick() {
// Clicou na parte superior vazia da lista
}
});
}
内容来源于网络,如有侵权,请联系作者删除!