- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我对 Android、java 和 HTML 真的很陌生。所以我吃饱了。我只是想通过 Android 应用程序从 URL 获取数据。我在 java 中尝试了以下代码并且它工作正常,所以我真的坚持它的问题所在。我尝试使用谷歌搜索并使用了不同的选项,例如设置连接时间
URL url = new URL("http://www.google.com/");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setDoInput(true);
conn.setDoOutput(true);
try {
input = new InputStreamReader(conn.getInputStream());
in =new BufferedReader(input);
}
我尝试了很多不同的版本,比如添加了一堆东西,比如: urlConnection.setRequestProperty("Connection", "keep-alive"); urlConnection.setRequestProperty("ConnectionTimeout", "12000"); urlConnection.setRequestProperty("Content-Length", ""+ request.length);
我认为下面的帖子也有类似的问题: IOException with URLConnection and getInputStream
我没有得到 IOException(好吧至少我不这么认为),但我得到了这个(以及一大堆其他的)
07-01 23:18:33.870: E/AndroidRuntime(30713): java.lang.IllegalStateException: 无法执行 Activity 的方法
是的,我确实添加了对 INTERNET 和 ACCESS_NETWORK_STATE 的权限
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name = "android.permission.ACCESS_NETWORK_STATE"/>
我正在使用 Eclipse 并在我的 Android HTC One X 上运行。请帮忙。提前致谢!
这是我添加 AsyncTask 后的堆栈跟踪:
07-02 00:02:34.775: W/IInputConnectionWrapper(3799): getExtractedText on inactive InputConnection
07-02 00:02:34.785: W/IInputConnectionWrapper(3799): getTextBeforeCursor on inactive InputConnection
07-02 00:02:34.785: W/IInputConnectionWrapper(3799): getSelectedText on inactive InputConnection
07-02 00:02:34.785: W/IInputConnectionWrapper(3799): getTextAfterCursor on inactive InputConnection
07-02 00:02:34.790: W/IInputConnectionWrapper(3799): getExtractedText on inactive InputConnection
07-02 00:02:34.795: W/IInputConnectionWrapper(3799): getTextBeforeCursor on inactive InputConnection
07-02 00:02:34.795: W/IInputConnectionWrapper(3799): getExtractedText on inactive InputConnection
07-02 00:02:34.795: W/IInputConnectionWrapper(3799): getTextBeforeCursor on inactive InputConnection
07-02 00:02:34.800: W/IInputConnectionWrapper(3799): getSelectedText on inactive InputConnection
07-02 00:02:34.800: W/IInputConnectionWrapper(3799): getTextAfterCursor on inactive InputConnection
07-02 00:02:34.800: W/IInputConnectionWrapper(3799): getExtractedText on inactive InputConnection
07-02 00:02:34.805: W/IInputConnectionWrapper(3799): getTextBeforeCursor on inactive InputConnection
07-02 00:02:34.805: W/IInputConnectionWrapper(3799): getSelectedText on inactive InputConnection
07-02 00:02:34.810: W/IInputConnectionWrapper(3799): getTextAfterCursor on inactive InputConnection
07-02 00:02:34.810: W/IInputConnectionWrapper(3799): beginBatchEdit on inactive InputConnection
07-02 00:02:34.815: W/IInputConnectionWrapper(3799): getExtractedText on inactive InputConnection
07-02 00:02:34.815: W/IInputConnectionWrapper(3799): getTextBeforeCursor on inactive InputConnection
07-02 00:02:34.820: W/IInputConnectionWrapper(3799): getSelectedText on inactive InputConnection
07-02 00:02:34.820: W/IInputConnectionWrapper(3799): getTextAfterCursor on inactive InputConnection
07-02 00:02:34.830: W/IInputConnectionWrapper(3799): getExtractedText on inactive InputConnection
07-02 00:02:34.830: W/IInputConnectionWrapper(3799): getTextBeforeCursor on inactive InputConnection
07-02 00:02:34.830: W/IInputConnectionWrapper(3799): getSelectedText on inactive InputConnection
07-02 00:02:34.835: W/IInputConnectionWrapper(3799): getTextAfterCursor on inactive InputConnection
07-02 00:02:34.845: W/IInputConnectionWrapper(3799): endBatchEdit on inactive InputConnection
07-02 00:02:34.845: W/IInputConnectionWrapper(3799): getExtractedText on inactive InputConnection
07-02 00:02:34.845: W/IInputConnectionWrapper(3799): getTextBeforeCursor on inactive InputConnection
07-02 00:02:34.850: W/IInputConnectionWrapper(3799): getSelectedText on inactive InputConnection
07-02 00:02:34.850: W/IInputConnectionWrapper(3799): getTextAfterCursor on inactive InputConnection
07-02 00:02:34.855: W/IInputConnectionWrapper(3799): beginBatchEdit on inactive InputConnection
07-02 00:02:34.855: W/IInputConnectionWrapper(3799): setComposingRegion on inactive InputConnection
07-02 00:02:34.855: W/IInputConnectionWrapper(3799): endBatchEdit on inactive InputConnection
07-02 00:02:34.865: W/IInputConnectionWrapper(3799): getExtractedText on inactive InputConnection
07-02 00:02:34.865: W/IInputConnectionWrapper(3799): getTextBeforeCursor on inactive InputConnection
07-02 00:02:34.870: W/IInputConnectionWrapper(3799): getSelectedText on inactive InputConnection
07-02 00:02:34.870: W/IInputConnectionWrapper(3799): getTextAfterCursor on inactive InputConnection
07-02 00:05:06.105: W/LoadedApk(5867): pakageInfo is null! try again
07-02 00:05:06.105: W/LoadedApk(5867): packageInfo still null!
07-02 00:05:06.110: D/LoadedApk(5867): dalvik.system.VMStack.getThreadStackTrace(Native Method)
07-02 00:05:06.110: D/LoadedApk(5867): java.lang.Thread.getStackTrace(Thread.java:599)
07-02 00:05:06.110: D/LoadedApk(5867): android.app.LoadedApk.initializeJavaContextClassLoader(LoadedApk.java:388)
07-02 00:05:06.110: D/LoadedApk(5867): android.app.LoadedApk.getClassLoader(LoadedApk.java:330)
07-02 00:05:06.110: D/LoadedApk(5867): android.app.LoadedApk.makeApplication(LoadedApk.java:535)
07-02 00:05:06.110: D/LoadedApk(5867): android.app.ActivityThread.handleBindApplication(ActivityThread.java:4803)
07-02 00:05:06.110: D/LoadedApk(5867): android.app.ActivityThread.access$1300(ActivityThread.java:151)
07-02 00:05:06.110: D/LoadedApk(5867): android.app.ActivityThread$H.handleMessage(ActivityThread.java:1401)
07-02 00:05:06.110: D/LoadedApk(5867): android.os.Handler.dispatchMessage(Handler.java:99)
07-02 00:05:06.110: D/LoadedApk(5867): android.os.Looper.loop(Looper.java:155)
07-02 00:05:06.110: D/LoadedApk(5867): android.app.ActivityThread.main(ActivityThread.java:5493)
07-02 00:05:06.110: D/LoadedApk(5867): java.lang.reflect.Method.invokeNative(Native Method)
07-02 00:05:06.110: D/LoadedApk(5867): java.lang.reflect.Method.invoke(Method.java:511)
07-02 00:05:06.110: D/LoadedApk(5867): com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1028)
07-02 00:05:06.110: D/LoadedApk(5867): com.android.internal.os.ZygoteInit.main(ZygoteInit.java:795)
07-02 00:05:06.110: D/LoadedApk(5867): dalvik.system.NativeStart.main(Native Method)
07-02 00:05:09.565: I/dalvikvm-heap(6053): Grow heap (frag case) to 5.448MB for 1705652-byte allocation
07-02 00:05:09.810: I/dalvikvm-heap(6053): Grow heap (frag case) to 8.340MB for 3034580-byte allocation
07-02 00:05:09.905: I/MediaPlayer(6053): setLPAflag() in
07-02 00:05:09.905: I/MediaPlayer(6053): mContext is null, can't getMirrorDisplayStatus!!!
07-02 00:05:09.905: I/MediaPlayer(6053): setLPAflag() out
07-02 00:05:09.910: W/MediaPlayer(6053): info/warning (1, 902)
07-02 00:05:09.915: D/MediaPlayer(6053): [DLNA]contentType = 902
07-02 00:05:09.915: D/MediaPlayer(6053): doStart() in
07-02 00:05:09.915: D/MediaPlayer(6053): getIntParameter = 902
07-02 00:05:10.190: D/MediaPlayer(6053): Mediaplayer receives message, message type: 200
07-02 00:05:10.190: I/MediaPlayer(6053): Info (1,902)
07-02 00:05:10.190: D/MediaPlayer(6053): Mediaplayer receives message, message type: 5
07-02 00:05:10.190: D/MediaPlayer(6053): Mediaplayer receives message, message type: 1
07-02 00:05:10.295: E/(6053): file /data/data/com.nvidia.NvCPLSvc/files/driverlist.txt: not found!
07-02 00:05:10.295: I/(6053): Attempting to load EGL implementation /system/lib//egl/libEGL_tegra_impl
07-02 00:05:10.485: I/(6053): Loaded EGL implementation /system/lib//egl/libEGL_tegra_impl
07-02 00:05:10.595: I/(6053): Loading GLESv2 implementation /system/lib//egl/libGLESv2_tegra_impl
07-02 00:05:11.080: W/IInputConnectionWrapper(6053): getExtractedText on inactive InputConnection
07-02 00:05:11.140: W/IInputConnectionWrapper(6053): getTextBeforeCursor on inactive InputConnection
07-02 00:05:11.430: I/dalvikvm-heap(6053): Grow heap (frag case) to 10.851MB for 2731536-byte allocation
07-02 00:05:11.830: I/MediaPlayer(6053): setLPAflag() in
07-02 00:05:11.830: I/MediaPlayer(6053): mContext is null, can't getMirrorDisplayStatus!!!
07-02 00:05:11.830: I/MediaPlayer(6053): setLPAflag() out
07-02 00:05:11.845: W/MediaPlayer(6053): info/warning (1, 902)
07-02 00:05:11.870: W/IInputConnectionWrapper(6053): getSelectedText on inactive InputConnection
07-02 00:05:11.875: D/MediaPlayer(6053): Mediaplayer receives message, message type: 200
07-02 00:05:11.875: I/MediaPlayer(6053): Info (1,902)
07-02 00:05:11.875: D/MediaPlayer(6053): Mediaplayer receives message, message type: 5
07-02 00:05:11.875: D/MediaPlayer(6053): Mediaplayer receives message, message type: 1
07-02 00:05:12.025: W/IInputConnectionWrapper(6053): getTextAfterCursor on inactive InputConnection
07-02 00:05:12.600: D/MediaPlayer(6053): [DLNA]contentType = 902
07-02 00:05:12.600: D/MediaPlayer(6053): doStart() in
07-02 00:05:12.600: D/MediaPlayer(6053): getIntParameter = 902
07-02 00:05:12.645: W/IInputConnectionWrapper(6053): getExtractedText on inactive InputConnection
07-02 00:05:12.940: W/IInputConnectionWrapper(6053): getExtractedText on inactive InputConnection
07-02 00:05:12.945: W/IInputConnectionWrapper(6053): getTextBeforeCursor on inactive InputConnection
07-02 00:05:12.950: W/IInputConnectionWrapper(6053): getSelectedText on inactive InputConnection
07-02 00:05:12.955: W/IInputConnectionWrapper(6053): getTextAfterCursor on inactive InputConnection
07-02 00:05:12.960: W/IInputConnectionWrapper(6053): getExtractedText on inactive InputConnection
07-02 00:05:12.965: W/IInputConnectionWrapper(6053): getTextBeforeCursor on inactive InputConnection
07-02 00:05:12.980: W/IInputConnectionWrapper(6053): getExtractedText on inactive InputConnection
07-02 00:05:12.980: W/IInputConnectionWrapper(6053): getTextBeforeCursor on inactive InputConnection
07-02 00:05:12.985: W/IInputConnectionWrapper(6053): getSelectedText on inactive InputConnection
07-02 00:05:12.985: W/IInputConnectionWrapper(6053): getTextAfterCursor on inactive InputConnection
07-02 00:05:12.995: W/IInputConnectionWrapper(6053): getExtractedText on inactive InputConnection
07-02 00:05:13.000: W/IInputConnectionWrapper(6053): getTextBeforeCursor on inactive InputConnection
07-02 00:05:13.000: W/IInputConnectionWrapper(6053): getSelectedText on inactive InputConnection
07-02 00:05:13.005: W/IInputConnectionWrapper(6053): getTextAfterCursor on inactive InputConnection
07-02 00:05:13.005: W/IInputConnectionWrapper(6053): getExtractedText on inactive InputConnection
07-02 00:05:13.010: W/IInputConnectionWrapper(6053): getTextBeforeCursor on inactive InputConnection
07-02 00:05:13.010: W/IInputConnectionWrapper(6053): getSelectedText on inactive InputConnection
07-02 00:05:13.010: W/IInputConnectionWrapper(6053): getTextAfterCursor on inactive InputConnection
07-02 00:05:13.015: W/IInputConnectionWrapper(6053): getExtractedText on inactive InputConnection
07-02 00:05:13.015: W/IInputConnectionWrapper(6053): getTextBeforeCursor on inactive InputConnection
07-02 00:05:13.015: W/IInputConnectionWrapper(6053): getSelectedText on inactive InputConnection
07-02 00:05:13.015: W/IInputConnectionWrapper(6053): getTextAfterCursor on inactive InputConnection
07-02 00:05:13.015: W/IInputConnectionWrapper(6053): beginBatchEdit on inactive InputConnection
07-02 00:05:13.020: W/IInputConnectionWrapper(6053): endBatchEdit on inactive InputConnection
07-02 00:05:13.020: W/IInputConnectionWrapper(6053): getExtractedText on inactive InputConnection
07-02 00:05:13.020: W/IInputConnectionWrapper(6053): getTextBeforeCursor on inactive InputConnection
07-02 00:05:13.020: W/IInputConnectionWrapper(6053): getSelectedText on inactive InputConnection
07-02 00:05:13.020: W/IInputConnectionWrapper(6053): getTextAfterCursor on inactive InputConnection
07-02 00:05:13.025: W/IInputConnectionWrapper(6053): beginBatchEdit on inactive InputConnection
07-02 00:05:13.025: W/IInputConnectionWrapper(6053): setComposingRegion on inactive InputConnection
07-02 00:05:13.025: W/IInputConnectionWrapper(6053): endBatchEdit on inactive InputConnection
07-02 00:05:13.025: W/IInputConnectionWrapper(6053): getExtractedText on inactive InputConnection
07-02 00:05:13.025: W/IInputConnectionWrapper(6053): getTextBeforeCursor on inactive InputConnection
07-02 00:05:13.025: W/IInputConnectionWrapper(6053): getSelectedText on inactive InputConnection
07-02 00:05:13.025: W/IInputConnectionWrapper(6053): getTextAfterCursor on inactive InputConnection
07-02 00:05:13.165: E/SpannableStringBuilder(6053): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
07-02 00:05:13.165: E/SpannableStringBuilder(6053): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
07-02 00:05:13.295: D/MediaPlayer(6053): Mediaplayer receives message, message type: 2
07-02 00:05:16.440: W/System.err(6053): java.io.FileNotFoundException: http://www.google.com/
07-02 00:05:16.445: W/System.err(6053): at libcore.net.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:177)
07-02 00:05:16.445: W/System.err(6053): at aiti.mit.edu.sa.wu.calculator.MyAsynTask.doInBackground(ActivityHi.java:139)
07-02 00:05:16.445: W/System.err(6053): at aiti.mit.edu.sa.wu.calculator.MyAsynTask.doInBackground(ActivityHi.java:1)
07-02 00:05:16.445: W/System.err(6053): at android.os.AsyncTask$2.call(AsyncTask.java:287)
07-02 00:05:16.445: W/System.err(6053): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
07-02 00:05:16.445: W/System.err(6053): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
07-02 00:05:16.445: W/System.err(6053): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
07-02 00:05:16.445: W/System.err(6053): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
07-02 00:05:16.450: W/System.err(6053): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
07-02 00:05:16.450: W/System.err(6053): at java.lang.Thread.run(Thread.java:864)
07-02 00:05:16.450: W/dalvikvm(6053): threadid=12: thread exiting with uncaught exception (group=0x40c392d0)
07-02 00:05:16.460: E/AndroidRuntime(6053): FATAL EXCEPTION: AsyncTask #1
07-02 00:05:16.460: E/AndroidRuntime(6053): java.lang.RuntimeException: An error occured while executing doInBackground()
07-02 00:05:16.460: E/AndroidRuntime(6053): at android.os.AsyncTask$3.done(AsyncTask.java:299)
07-02 00:05:16.460: E/AndroidRuntime(6053): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
07-02 00:05:16.460: E/AndroidRuntime(6053): at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
07-02 00:05:16.460: E/AndroidRuntime(6053): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
07-02 00:05:16.460: E/AndroidRuntime(6053): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
07-02 00:05:16.460: E/AndroidRuntime(6053): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
07-02 00:05:16.460: E/AndroidRuntime(6053): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
07-02 00:05:16.460: E/AndroidRuntime(6053): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
07-02 00:05:16.460: E/AndroidRuntime(6053): at java.lang.Thread.run(Thread.java:864)
07-02 00:05:16.460: E/AndroidRuntime(6053): Caused by: java.lang.NullPointerException
07-02 00:05:16.460: E/AndroidRuntime(6053): at aiti.mit.edu.sa.wu.calculator.MyAsynTask.doInBackground(ActivityHi.java:153)
07-02 00:05:16.460: E/AndroidRuntime(6053): at aiti.mit.edu.sa.wu.calculator.MyAsynTask.doInBackground(ActivityHi.java:1)
07-02 00:05:16.460: E/AndroidRuntime(6053): at android.os.AsyncTask$2.call(AsyncTask.java:287)
07-02 00:05:16.460: E/AndroidRuntime(6053): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
07-02 00:05:16.460: E/AndroidRuntime(6053): ... 5 more
07-02 00:05:19.770: D/Process(6053): killProcess, pid=6053
07-02 00:05:19.800: D/Process(6053): dalvik.system.VMStack.getThreadStackTrace(Native Method)
07-02 00:05:19.800: D/Process(6053): java.lang.Thread.getStackTrace(Thread.java:599)
07-02 00:05:19.800: D/Process(6053): android.os.Process.killProcess(Process.java:944)
07-02 00:05:19.800: D/Process(6053): com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java:108)
07-02 00:05:19.800: D/Process(6053): java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
07-02 00:05:19.800: D/Process(6053): java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)
07-02 00:05:20.290: I/dalvikvm-heap(6336): Grow heap (frag case) to 5.287MB for 1536016-byte allocation
07-02 00:05:20.375: I/dalvikvm-heap(6336): Grow heap (frag case) to 7.890MB for 2731536-byte allocation
07-02 00:05:20.590: I/MediaPlayer(6336): setLPAflag() in
07-02 00:05:20.590: I/MediaPlayer(6336): mContext is null, can't getMirrorDisplayStatus!!!
07-02 00:05:20.590: I/MediaPlayer(6336): setLPAflag() out
07-02 00:05:20.590: W/MediaPlayer(6336): info/warning (1, 902)
07-02 00:05:20.635: D/MediaPlayer(6336): Mediaplayer receives message, message type: 200
07-02 00:05:20.635: I/MediaPlayer(6336): Info (1,902)
07-02 00:05:20.635: D/MediaPlayer(6336): Mediaplayer receives message, message type: 5
07-02 00:05:20.635: D/MediaPlayer(6336): Mediaplayer receives message, message type: 1
07-02 00:05:20.685: E/(6336): file /data/data/com.nvidia.NvCPLSvc/files/driverlist.txt: not found!
07-02 00:05:20.685: I/(6336): Attempting to load EGL implementation /system/lib//egl/libEGL_tegra_impl
07-02 00:05:20.735: I/(6336): Loaded EGL implementation /system/lib//egl/libEGL_tegra_impl
07-02 00:05:20.820: I/(6336): Loading GLESv2 implementation /system/lib//egl/libGLESv2_tegra_impl
07-02 00:05:21.215: E/SpannableStringBuilder(6336): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
07-02 00:05:21.215: E/SpannableStringBuilder(6336): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
07-02 00:05:22.575: E/SpannableStringBuilder(6336): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
07-02 00:05:22.575: E/SpannableStringBuilder(6336): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
这是 AsyncTank...
protected String doInBackground(String... arg0) {
try {
URL url = new URL("http://www.google.com/");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setDoInput(true);
conn.setDoOutput(true);
input = new InputStreamReader(conn.getInputStream());
in =new BufferedReader(input);
System.out.println("HELLO");
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
finally {
conn.disconnect();
}
return null;
}
最佳答案
您发布的 AsyncTask 使问题显而易见。注释掉 153 只是隐藏了错误。
您在 try block 内声明并分配 conn
(HttpURLConnection conn = (HttpURLConnection) url.openConnection();
),并在 中断开连接终于
。
但是您连接到的 conn
在 finally block 中是不可见的。这意味着您可能有一个同名的成员变量。您正在尝试断开连接。
你得到一个 NullPointerException 因为成员是 null。
首先,我建议将 conn
更改为 conn2
之类的内容,以使问题更加明显(您将在第 153 行遇到编译错误) .
正确的解决方案是将 conn
的声明和赋值移到 try block 之外,以便它对 finally block 可见,并适本地重新调整 catch block 。类似的东西(我还没有测试过):
protected String doInBackground(String... arg0) {
try {
URL url = new URL("http://www.google.com/");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
try {
conn.setDoInput(true);
conn.setDoOutput(true);
input = new InputStreamReader(conn.getInputStream());
in =new BufferedReader(input);
System.out.println("HELLO");
}
finally {
conn.disconnect();
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
关于java - Android - .getInputStream() 不断崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17414101/
我最近在/ drawable中添加了一些.gifs,以便可以将它们与按钮一起使用。这个工作正常(没有错误)。现在,当我重建/运行我的应用程序时,出现以下错误: Error: Gradle: Execu
Android 中有返回内部存储数据路径的方法吗? 我有 2 部 Android 智能手机(Samsung s2 和 s7 edge),我在其中安装了一个应用程序。我想使用位于这条路径中的 sqlit
这个问题在这里已经有了答案: What's the difference between "?android:" and "@android:" in an android layout xml f
我只想知道 android 开发手机、android 普通手机和 android root 手机之间的实际区别。 我们不能从实体店或除 android marketplace 以外的其他地方购买开发手
自Gradle更新以来,我正在努力使这个项目达到标准。这是一个团队项目,它使用的是android-apt插件。我已经进行了必要的语法更改(编译->实现和apt->注释处理器),但是编译器仍在告诉我存在
我是android和kotlin的新手,所以请原谅要解决的一个非常简单的问题! 我已经使用导航体系结构组件创建了一个基本应用程序,使用了底部的导航栏和三个导航选项。每个导航选项都指向一个专用片段,该片
我目前正在使用 Facebook official SDK for Android . 我现在正在使用高级示例应用程序,但我不知道如何让它获取应用程序墙/流/状态而不是登录的用户。 这可能吗?在那种情
我在下载文件时遇到问题, 我可以在模拟器中下载文件,但无法在手机上使用。我已经定义了上网和写入 SD 卡的权限。 我在服务器上有一个 doc 文件,如果用户单击下载。它下载文件。这在模拟器中工作正常但
这个问题在这里已经有了答案: What is the difference between gravity and layout_gravity in Android? (22 个答案) 关闭 9
任何人都可以告诉我什么是 android 缓存和应用程序缓存,因为当我们谈论缓存清理应用程序时,它的作用是,缓存清理概念是清理应用程序缓存还是像内存管理一样主存储、RAM、缓存是不同的并且据我所知,缓
假设应用程序 Foo 和 Eggs 在同一台 Android 设备上。任一应用程序都可以获取设备上所有应用程序的列表。一个应用程序是否有可能知道另一个应用程序是否已经运行以及运行了多长时间? 最佳答案
我有点困惑,我只看到了从 android 到 pc 或者从 android 到 pc 的例子。我需要制作一个从两部手机 (android) 连接的 android 应用程序进行视频聊天。我在想,我知道
用于使用 Android 以编程方式锁定屏幕。我从 Stackoverflow 之前关于此的问题中得到了一些好主意,并且我做得很好,但是当我运行该代码时,没有异常和错误。而且,屏幕没有锁定。请在这段代
文档说: android:layout_alignParentStart If true, makes the start edge of this view match the start edge
我不知道这两个属性和高度之间的区别。 以一个TextView为例,如果我将它的layout_width设置为wrap_content,并将它的width设置为50 dip,会发生什么情况? 最佳答案
这两个属性有什么关系?如果我有 android:noHistory="true",那么有 android:finishOnTaskLaunch="true" 有什么意义吗? 最佳答案 假设您的应用中有
我是新手,正在尝试理解以下 XML 代码: 查看 developer.android.com 上的文档,它说“starStyle”是 R.attr 中的常量, public static final
在下面的代码中,为什么当我设置时单选按钮的外观会发生变化 android:layout_width="fill_parent" 和 android:width="fill_parent" 我说的是
很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visit the help center . 关闭 9
假设我有一个函数 fun myFunction(name:String, email:String){},当我调用这个函数时 myFunction('Ali', 'ali@test.com ') 如何
我是一名优秀的程序员,十分优秀!