Questions tagged «android»

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

10
“ SDK平台工具组件丢失!”
我正在尝试通过此线程将添加的SDK Platform 1.6添加到现有的Install 2.2中。 如建议的那样,我运行Help→ Check for Updates,它找到并安装了以下内容: + Android DDMS 8.0.1.v201012062107-82219 + Android Development Tools 8.0.1.v201012062107-82219 It prompted for restarting Eclipse and when it restarted it gave me the following error message: "SDK Platform Tools component is missing! Please use the SDK Manager to install it." Huh? Why? I …

13
尝试将SD卡中的文件附加到电子邮件
我正在尝试启动一个意图来发送电子邮件。所有这些都有效,但是当我尝试实际发送电子邮件时,会发生一些“奇怪”的事情。 这是代码 Intent sendIntent = new Intent(Intent.ACTION_SEND); sendIntent.setType("image/jpeg"); sendIntent.putExtra(Intent.EXTRA_SUBJECT, "Photo"); sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://sdcard/dcim/Camera/filename.jpg")); sendIntent.putExtra(Intent.EXTRA_TEXT, "Enjoy the photo"); startActivity(Intent.createChooser(sendIntent, "Email:")); 因此,如果我使用Gmail菜单上下文启动,它将显示附件,让我键入电子邮件的收件人,并编辑正文和主题。没什么大不了的。我点击发送,它发送。唯一的事情是附件不会被发送。 所以。我想到了,为什么不尝试使用电子邮件菜单上下文(对于手机上的备用电子邮件帐户)呢?它显示附件,但在正文或主题中根本没有文本。当我发送邮件时,附件发送正确。那会让我相信有些不对劲。我需要在清单中启动新的许可以启动带有附件的电子邮件发送意图吗?我究竟做错了什么?


10
首次安装.apk时如何启动服务
在我的应用程序中,我没有任何用户界面部分,因此,一旦在设备上安装了Applicaton,就需要启动服务。我看到许多链接,答案是不可能的,但我想肯定有可能。只需看看确实满足我要求的Android Market上的PlanB应用程序即可。以下是我尝试的清单文件,但是根本没有调用服务。因此,请让我知道安装应用程序后启动服务的最佳方法是什么。 更新 我还尝试使用android.intent.action.PACKAGE_ADDED它可以很好地检测其他应用程序的软件包,但不能检测其本身。 <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.auto.start" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> <application android:icon="@drawable/ic_launcher" > <service android:name=".MyService"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </service> <receiver android:name=".BootUpReceiver"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED"/> <category android:name="android.intent.category.DEFAULT"/> <action android:name="android.intent.action.PACKAGE_INSTALL" /> <action android:name="android.intent.action.PACKAGE_ADDED" /> <data android:scheme="package"/> </intent-filter> </receiver> </application> …

5
片段内部类应该是静态的
我有一个FragmentActivity应该显示内部类的类Dialog。但是我必须做到static。Eclipse为我提供了抑制错误的方法@SuppressLint("ValidFragment")。如果我这样做不好,会带来什么后果? public class CarActivity extends FragmentActivity { //Code @SuppressLint("ValidFragment") public class NetworkConnectionError extends DialogFragment { private String message; private AsyncTask task; private String taskMessage; @Override public void setArguments(Bundle args) { super.setArguments(args); message = args.getString("message"); } public void setTask(CarActivity.CarInfo task, String msg) { this.task = task; this.taskMessage = msg; } @Override …

4
Android模拟器:qemu-system-i386.exe:goldfish_battery_read:错误的偏移量
因此,每当我尝试在android模拟器上启动我的应用程序时,IDE都会受到以下错误的轰炸: Emulator: qemu-system-i386.exe: goldfish_battery_read: Bad offset....... 当应用程序每分钟左右运行时,也会显示此错误。 我正在使用 Android Studio 3 Beta 6 API等级26 仿真器26.1.4 Android SDK 工具26.1.1 图像x86 26(oreo) ... 我尝试重新安装所有SDK工具,并将所有内容更新为最新版本,但没有运气。我还重新安装了IDE并重新下载了所有内容,它仍然显示此错误。 我想知道是否有人也遇到此错误?

13
Android Firebase DynamiteModule:无法加载模块描述符
由于升级到最新版本的Firebase(9.0.0),通过进行用户身份验证时,我无法摆脱以下两个错误signInWithEmailAndPassword()。有人知道发生了什么吗? 05-19 18:09:49.245 23550-23589/[PACKAGE] E/DynamiteModule: Failed to load module descriptor class: Didn't find class "com.google.android.gms.dynamite.descriptors.com.google.firebase.auth.ModuleDescriptor" on path: DexPathList[[zip file "/data/app/[PACKAGE]-3/base.apk"],nativeLibraryDirectories= [/data/app/[PACKAGE]-3/lib/x86, /vendor/lib, /system/lib]] 和 05-19 18:09:49.252 23550-23550/[PACKAGE] E/FirebaseApp: Firebase API initialization failure.java.lang.reflect.InvocationTargetException at java.lang.reflect.Method.invoke(Native Method) at com.google.firebase.FirebaseApp.zza(Unknown Source) at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) at com.google.firebase.FirebaseApp.zzbu(Unknown Source) at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source) …

5
Google护目镜API [关闭]
关闭。此问题不符合堆栈溢出准则。它当前不接受答案。 想改善这个问题吗?更新问题,使其成为Stack Overflow的主题。 4年前关闭。 改善这个问题 有人知道是否有适用于Android的Google泳镜API吗?如果没有,很快会有人来吗?有了针对此事的API,可能性就无穷无尽... 到目前为止,我在此主题上只能找到的一个讨论是,由于其“谷歌实验室”状态(iPhone版本一旦更“完整”就将推出),目前没有适用于iPhone的版本。我希望可以在那时发布API。有人对此有任何信息吗?

2
如何在android中为pdf查看器进行注释,例如突出显示,删除线,下划线,绘制,添加文本等?
下图显示了Android市场中的RepliGo,Aldiko,Mantano,ezPdf等许多应用程序在其pdf查看器中进行这种注释的方式。 我尝试了多种方法来实现此注释,但失败了。我有一个用于Android的pdf查看器,并使用了iText绘制线条来为注释使用单独的Java代码。 我的问题是我可以在android中实现iText吗?如果可能,我必须导入哪个软件包? 同样在某些应用中,画布方法用于绘制线条。是否可以在Android中包含此canvas方法,而不使用注释?目标是具有与批注相同的功能。 在下图中(RepliGo PDF Reader),他们使用了哪种代码进行注释?


6
如何在Android中添加新联系人
我写了以下代码在android电话簿中添加新联系人,它正在工作,但是当我打开联系人菜单时,我看不到添加的新联系人。谁能帮我找出问题所在? import android.app.Activity; import android.os.Bundle; import android.content.ContentResolver; import android.content.ContentValues; import android.provider.ContactsContract; import android.widget.TextView; import android.widget.Toast; public class AddContacts extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); try { ContentResolver cr = this.getContentResolver(); ContentValues cv = new ContentValues(); cv.put(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME, …
69 android 

9
Android如何用手指画一条平滑的线
http://marakana.com/tutorials/android/2d-graphics-example.html 我在下面使用这个例子。但是,当我在屏幕上移动手指的速度过快时,线条会变成单个点。 我不确定是否可以加快绘图速度。或者我应该用一条直线连接最后两个点。这两种解决方案中的第二种似乎是一个不错的选择,除了快速移动手指时,您会得到一条较长的直线段,然后是锐利的曲线。 如果还有其他解决方案,那将是非常高兴的。 感谢您的任何提前帮助。

6
将函数作为参数传递给Java
我已经熟悉Android框架和Java,并想创建一个通用的“ NetworkHelper”类,该类可以处理大多数联网代码,使我能够从中调用网页。 我遵循了来自developer.android.com的这篇文章来创建我的网络类:http : //developer.android.com/training/basics/network-ops/connecting.html 码: package com.example.androidapp; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.URL; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.AsyncTask; import android.util.Log; /** * @author tuomas * This class provides basic helper functions and features for network communication. */ public …

5
有没有办法预览可绘制的矢量
缺少构建和安装我的应用程序,有没有办法预览矢量可绘制xml文件? 我已经将其内置到Android Studio中的一个小型测试应用中,并且可以将其作为布局文件的一部分进行预览,但是我希望有一种更简单的方法。 编辑:这是我的drawable.xml文件的样子: <?xml version="1.0" encoding="utf-8"?> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24"> <group> <path android:fillColor="#f5a625" android:strokeColor="#000000" android:strokeWidth=".5" android:pathData="M0,0l18,0l6,6l0,10l-24,0z" /> </group> </vector>
69 android  svg 

5
对于所有Android UI对象,getHeight返回0
我正在构建一个UI,并且都是在XML中静态定义的。它所有的地方都具有重量,虽然看起来正确,但我想看到所有东西实际上都具有正确的高度。问题是,无论我在哪里为格式布局调用.getHeight(),都得到0。我在onCreate()和onStart()中都尝试过。一样。也会发生所有UI对象。任何想法? package com.app.conekta; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.Window; import android.widget.Button; import android.widget.FrameLayout; import android.widget.Toast; public class Conekta extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { requestWindowFeature(Window.FEATURE_NO_TITLE); super.onCreate(savedInstanceState); setContentView(R.layout.main); } @Override public void onStart() { super.onStart(); } @Override …

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.