【问题标题】:ACTION_LOCATION_SOURCE_SETTINGS : cannot be resolved or is not a fieldACTION_LOCATION_SOURCE_SETTINGS :无法解析或不是字段
【发布时间】:2014-03-27 03:10:52
【问题描述】:

我正在通过 Intent 调用 ACTION_LOCATION_SOURCE_SETTINGS。它显示无法解析或不是从外部导入项目时导致的字段。我现在该怎么办?

Intent viewIntent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
                        startActivity(viewIntent);

【问题讨论】:

  • 您是否将import android.provider.Settings; 导入到您的活动中?
  • 这个我试过了,不是Importing-import android.provider.Settings;
  • 为什么?因为它在我的情况下工作。
  • 您是否将其导入到您的活动中?
  • 那么结论是旧的 Android 集 Settings.ACTION_LOCATION_SOURCE_SETTINGS 和新的 Android 集 android.provider.Settings.ACTION_LOCATION_SOURCE_SETTING‌​S

标签: android android-intent android-location


【解决方案1】:

试试这个..

我猜你的导入是错误的

使用

import android.provider.Settings;

或者像下面这样尝试。

Intent viewIntent = new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(viewIntent);

【讨论】:

  • 我试过这种方式但是设置没有导入,即使我复制了 import android.provider.Settings;显示为删除导入错误
【解决方案2】:

在 Eclipse 检查项目的属性中,选择“Android”并检查目标名称是“Android 6.0”或 +

【讨论】:

    猜你喜欢
    • 2022-01-09
    • 2014-01-05
    • 2016-05-20
    • 2016-02-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多