Questions tagged «android»

Android是Google的移动操作系统,用于对数字设备(智能手机,平板电脑,汽车,电视,Wear,Glass和IoT)进行编程或开发。对于与Android相关的主题,请使用特定于Android的标签,例如android-intent,android-activity,android-adapter等。对于与开发或编程无关但与Android框架相关的问题,请使用以下链接:https:// android.stackexchange.com。

5
onTouchListener警告:检测到单击时,onTouch应该调用View#performClick
我创建了一个onTouchListener。不幸的是,onTouch()向throws我发出警告: com/calculator/activitys/Calculator$1#onTouch should call View#performClick when a click is detected 这是什么意思?我尚未找到有关此警告的任何信息。这是完整的代码: LinearLayout llCalculatorContent = (LinearLayout) fragmentView.findViewById(R.id.calculator_content); llCalculatorContent.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { Tools.hideKeyboard(getActivity(), getView()); getView().clearFocus(); return false; } });

13
Android Studio运行/调试配置错误:未指定模块
我在运行配置中收到“未指定模块”错误。下拉菜单中没有显示模块,但是我看不到模块的任何问题。当我重构模块名称,将settings.gradle更改为新名称时,就会出现问题。 现在,当我进入项目结构并选择我的模块时,屏幕上没有任何显示,甚至没有错误。 我不确定100%,但是模块旁边的图标看起来像是带杯子的文件夹,而不是带电话的文件夹。 我的确切步骤- 在Android视图中打开 重构目录名称 重构模块名称 更改settings.gradle内容:将名称更改为新名称

7
加载数据后如何防止滚动视图滚动到Web视图?
所以我有一个令人着迷的问题。尽管我没有手动或以编程方式滚动视图,但加载内部数据后,WebView仍会自动滚动到。 我在viewpager中有一个片段。当我第一次加载寻呼机时,它会按预期工作,并且显示所有内容。但是,一旦我“翻转页面”,数据就会加载,并且WebView会弹出到页面顶部,将其上方的视图隐藏起来,这是不希望的。 有谁知道如何防止这种情况的发生? 我的布局看起来像这样: <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/background" > <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <TextView android:id="@+id/article_title" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginRight="10dp" android:layout_marginLeft="10dp" android:layout_marginTop="10dp" android:layout_marginBottom="2dp" android:text="Some Title" android:textAppearance="?android:attr/textAppearanceLarge" android:textColor="@color/article_title" android:textStyle="bold" /> <LinearLayout android:id="@+id/LL_Seperator" android:layout_width="fill_parent" android:layout_height="1dp" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:layout_marginTop="5dp" android:layout_marginBottom="5dp" android:background="@color/text" android:orientation="horizontal" > </LinearLayout> <WebView android:id="@+id/article_content" android:layout_width="match_parent" android:layout_marginRight="10dp" android:layout_marginLeft="10dp" android:layout_height="wrap_content" …

7
如何在由geo URI Intent启动的地图中显示标记?
我有一个应用程序,通过启动具有特定地理位置的Google地图,可以显示不同的位置(一次由用户输入选择)。 我目前正在使用它(当然具有真实的纬度和经度值): Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("geo:<lat>,<long>?z=17")); startActivity(intent); 它完全是我想要的,除了它不显示指定点的任何指示器或标记。它仅在其位置居中。 是否有某种方法可以在不使用MapView的情况下获得标记或其他内容?



17
Android Studio-ADB错误-“…设备未授权。请检查设备上的确认对话框。”
因此,我开始在我的ADB日志中发现错误,我认为这导致我的设备现在显示应用程序的任何logcat输出。我正在获取除应用程序本身以外的所有logcat输出。 PropertyFetcher: AdbCommandRejectedException getting properties for device 04799057970ed1fc: device offline PropertyFetcher: AdbCommandRejectedException getting properties for device 03799467970ed5fg: device unauthorized. Please check the confirmation dialog on your device.

16
AVD Manager-无法创建Android虚拟设备
昨天我刚刚从Google安装了Android Eclipse插件和Android SDK。我通过转到打开AVD Manager窗口Window -> Android Virtual Device Manager。然后,我单击“新建”,并显示“创建新的Android虚拟设备(AVD)”窗口。问题是,我无法使“确定”按钮不显示为灰色。我从“设备”中选择Nexus 7,为AVD命名,然后选择“ Android 4.2 API Level 17”作为目标。而且,无论我对其余设置执行什么操作,“确定”按钮都将继续显示为灰色。我没有出现任何错误。关于我可能会丢失的内容以及为什么窗口不允许我单击“确定”进行操作的任何想法?
107 android  eclipse 

15
无法为Flutter项目找到lint-gradle-api-26.1.2.jar
我是Flutter的新手,尝试在创建新项目时运行示例项目。尝试运行它时,出现以下问题: 失败:生成失败,发生异常。 其中:构建文件“ PROJECTPATH / android / app / build.gradle”行:25 出了什么问题:评估项目':app'时发生问题。 无法解析配置“ classpath”的所有文件。找不到lint-gradle-api.jar(com.android.tools.lint:lint-gradle-api:26.1.2)。在以下位置搜索:https : //jcenter.bintray.com/com/android/tools/lint/lint-gradle-api/26.1.2/lint-gradle-api-26.1.2.jar 我了解它正在尝试从jcenter存储库中获取文件“ lint-gradle-api-26.1.2.jar”,但是当您点击链接时,我得到的是: { "errors" : [ { "status" : 404, "message" : "Could not find resource" } ] } 因此,我在build.gradle文件中添加了Google存储库: buildscript { repositories { maven { url 'https://dl.google.com/' } google() jcenter() } ...而且我也通过以下链接成功获取了文件: https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint-gradle-api/26.1.2/lint-gradle-api-26.1.2.jar ...但是无论是通过使用Visual …
107 android  dart  flutter  jcenter 

7
android通过Uri.getPath()获取真实路径
我正在尝试从画廊获得图像。 Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent, "Select picture"), resultCode ); 从此活动返回后,我得到了一个包含Uri的数据。看起来像: content://media/external/images/1 如何将这条路径转换为真实路径(就像' /sdcard/image.png')? 谢谢

23
无法将签名的APK手动安装到设备,出现错误“未安装应用程序”
我想将我的应用发布给GooglePlay,但首先,我想对签名的apk做最后一次测试,以确保所有使用的API密钥都能与发行版(GMaps,Facebook等)一起正常使用 所以我只是用我们的发布密钥制作了一个签名的应用程序版本,当我尝试将应用程序安装到设备上时出现错误: 我试图将apk复制到设备并使用apk安装程序应用程序进行安装。 奇怪的是,当我使用调试签名密钥执行相同的过程时,一切都很好,我可以安装并运行该应用程序。 以下是该过程的步骤: 我选择释放键,输入密码。 我选择发布版本类型而不是调试 以防万一我还在gradle文件中定义了签名密钥,但我必须承认我不知道这是必要的。 我现在已经尝试了7次7次,所以我认为这个问题不仅是密码输入错误,而且我可以使用标准的debug android签名密钥来实现此目的。 如果可以的话请帮忙。

7
Android-启动时启动服务
从我在Stack Exchange和其他地方看到的所有内容中,我已经正确设置了所有内容,可以在启动Android OS时启动IntentService。不幸的是,它没有在启动时启动,并且我没有收到任何错误。也许专家可以帮忙... 表现: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.phx.batterylogger" android:versionCode="1" android:versionName="1.0" android:installLocation="internalOnly"> <uses-sdk android:minSdkVersion="8" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.BATTERY_STATS" /> <application android:icon="@drawable/icon" android:label="@string/app_name"> <service android:name=".BatteryLogger"/> <receiver android:name=".StartupIntentReceiver"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> </intent-filter> </receiver> </application> </manifest> 用于启动的BroadcastReceiver: package com.phx.batterylogger; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; public …

8
从字符串到json对象的转换android
我正在开发一个Android应用程序。在我的应用程序中,我必须将字符串转换为Json Object,然后解析值。我检查了stackoverflow中的解决方案,并在此处找到了类似的问题链接 解决方案是这样的 `{"phonetype":"N95","cat":"WP"}` JSONObject jsonObj = new JSONObject("{\"phonetype\":\"N95\",\"cat\":\"WP\"}"); 我在代码中使用相同的方式。我的绳子是 {"ApiInfo":{"description":"userDetails","status":"success"},"userDetails":{"Name":"somename","userName":"value"},"pendingPushDetails":[]} string mystring= mystring.replace("\"", "\\\""); 替换后,我得到了这样的结果 {\"ApiInfo\":{\"description\":\"userDetails\",\"status\":\"success\"},\"userDetails\":{\"Name\":\"Sarath Babu\",\"userName\":\"sarath.babu.sarath babu\",\"Token\":\"ZIhvXsZlKCNL6Xj9OPIOOz3FlGta9g\",\"userId\":\"118\"},\"pendingPushDetails\":[]} 当我执行 JSONObject jsonObj = new JSONObject(mybizData); 我收到以下json异常 org.json.JSONException: Expected literal value at character 1 of 请帮助我解决我的问题。

5
通过扩大布局来创建自定义视图?
我正在尝试创建一个自定义视图,该视图将替换我在多个地方使用的特定布局,但是我为此很努力。 基本上,我想替换为: <RelativeLayout android:id="@+id/dolphinLine" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_centerInParent="true" android:background="@drawable/background_box_light_blue" android:padding="10dip" android:layout_margin="10dip"> <TextView android:id="@+id/dolphinTitle" android:layout_width="200dip" android:layout_height="100dip" android:layout_alignParentLeft="true" android:layout_marginLeft="10dip" android:text="@string/my_title" android:textSize="30dip" android:textStyle="bold" android:textColor="#2E4C71" android:gravity="center"/> <Button android:id="@+id/dolphinMinusButton" android:layout_width="100dip" android:layout_height="100dip" android:layout_toRightOf="@+id/dolphinTitle" android:layout_marginLeft="30dip" android:text="@string/minus_button" android:textSize="70dip" android:textStyle="bold" android:gravity="center" android:layout_marginTop="1dip" android:background="@drawable/button_blue_square_selector" android:textColor="#FFFFFF" android:onClick="onClick"/> <TextView android:id="@+id/dolphinValue" android:layout_width="100dip" android:layout_height="100dip" android:layout_marginLeft="15dip" android:background="@android:drawable/editbox_background" android:layout_toRightOf="@+id/dolphinMinusButton" android:text="0" android:textColor="#2E4C71" android:textSize="50dip" android:gravity="center" android:textStyle="bold" android:inputType="none"/> <Button android:id="@+id/dolphinPlusButton" …
107 android  xml  view 

9
如何停止在Eclipse下运行的程序?
我找不到停止正在运行的程序的选项(无论是在调试模式还是释放模式下)。 因此,现在,我仅通过关闭模拟器即可停止程序(将控制权返回给Eclipse)。 有更好的方法吗?这样我就不需要关闭(并重新启动)模拟器吗?

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.