logdでログを出すことは出来るのですが、やり方がわからなくて苦戦してます。
表示したいのは、
Log.d("MyActivity", "UUID:" + beacon.getId1() + ", major:" + beacon.getId2() + ", minor:" + beacon.getId3() + ", Distance:" + beacon.getDistance());
の中で、
beacon.getId1()
beacon.getDistance()
この2つを
tb.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { textView[0] = (TextView) findViewById(R.id.textView); textView[0].setText(isChecked ? "もう一度探す" : "ビーコンを探しています・・・"); textView[0] = (TextView) findViewById(R.id.textView2); textView[0].setText(isChecked ? null : "UUID:"+ ”◆ここに入れてみたいです◆”); imageView.setImageResource(isChecked ? R.mipmap.ic_launcher : R.mipmap.ic_android); Log.d("ToggleButton", "OnCheckedChangeListenerが呼ばれました。"); } }
ボタンを押したときにログ結果で使われている、beacon.getId1()
beacon.getDistance()をテキスト表示するようにしたいです。
上手く組み合わせることが何か方法はありませんか?
参考サイトとかあれば教えてください。お願いします。
追記 ここの中に追加した方がいいですか?
@Override
public void onBeaconServiceConnect() {
beaconManager.setRangeNotifier(new RangeNotifier() {
@Override
public void didRangeBeaconsInRegion(Collection<Beacon> beacons, Region region) {
for (Beacon beacon : beacons) {
Log.d("MyActivity", "UUID:" + beacon.getId1() + ", major:" + beacon.getId2() + ", minor:" + beacon.getId3() + ", Distance:" + beacon.getDistance());
} } }); try { beaconManager.startRangingBeaconsInRegion(new Region("unique-ranging-region-id", null, null, null)); } catch (RemoteException e) { e.printStackTrace(); }
回答3件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。