如何在didRangeBeaconsInRegion中显示数据库中的数据?(How to Display data from the database in didRangeBeaconsInRegion?)
当在特定距离内检测到信标时,我想从数据库向textview显示数据....问题是它不起作用或不显示任何内容这里是我的代码...
public void didRangeBeaconsInRegion(Collection<Beacon> beacons, Region region) { if (beacons.size() > 0) { for (Beacon beacon: beacons) { if(beacon.getDistance() < 0.5){ ddb(); //Call Display data from database }它与每秒的范围有关吗?
是否可以使用didRangeBeaconsInRegion显示数据库中的数据?
I want to display data to the textview from the database when the beacon is detected in specific distance .... the problem is it does not work or does not display anything here's my code ...
public void didRangeBeaconsInRegion(Collection<Beacon> beacons, Region region) { if (beacons.size() > 0) { for (Beacon beacon: beacons) { if(beacon.getDistance() < 0.5){ ddb(); //Call Display data from database }Does it has something to do with ranging every second?
Is it possible to display data from the database using didRangeBeaconsInRegion?
最满意答案
尝试添加日志行以进行故障排除,如下所示:
for (Beacon beacon: beacons) { Log.d(TAG, "saw beacon:"+beacon+" with dist "+beacon.getDistance() ); if(beacon.getDistance() < 0.5) { Log.d(TAG, " calling ddb"); ddb(); //Call Display data from database } }检查您是否看到第一个日志行,并验证如果距离小于0.5,则显示第二个日志行。
Try adding log lines to troubleshoot like this:
for (Beacon beacon: beacons) { Log.d(TAG, "saw beacon:"+beacon+" with dist "+beacon.getDistance() ); if(beacon.getDistance() < 0.5) { Log.d(TAG, " calling ddb"); ddb(); //Call Display data from database } }Check to see that you see the first log line, and verify that if the distance is less than 0.5 the second log line is shown.
更多推荐
发布评论