缺少参数界面Android

时间:2016-06-02 15:10:26

标签: android parameters interface geolocation

我在我的代码中使用了这样的界面:

public interface OnSetListener {
    void onInitShift(long datetime, double lat, double lon);

    void onFinishShift(long datetime, double lat, double lon, String comments);

    void onChangeToPause(long datetime, String reason_id, String description, double lat, double lon);

    void onChangeToMove(long datetime, String vehicle, String pk_vehicle, double lat, double lon);

    void onReturnToWork(long datetime, double lat, double lon);
}

我使用这一行调用第一个方法,我可以保证100%它具有正确的值,因为我调试它。

_callback.onInitShift(Calendar.getInstance().getTimeInMillis() , my_location.getLatitude(), my_location.getLongitude());

以下是我实现的界面:

f_status.setOnSetListener(new FragmentChangeUserActivity.OnSetListener()) {
    @Override
    public void onInitShift(long datetime, double lat, double lon) { 
        String user = app_data_db.getAppUserCompleteName(_userSQLiteID);
....

问题在于,出于某种原因,我只接收参数日期时间 lat ,会出现 lon 参数虽然我调试了代码,但是 my_location.getLongitude()有价值,但是没有任何价值。

我错过了什么吗?

提前致谢

编辑:

private LocationListener ll_check_coords = new LocationListener() {
    @Override
    public void onLocationChanged(Location location) {
        my_location = location;
 ....

这是我获取位置并在变量 my_location

中使用它的方法

0 个答案:

没有答案