- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我正在 Android 上开发一个处理视频文件的加密和解密应用程序。我的应用程序在某些设备上运行完美,但在某些设备上崩溃,同时处理相同的文件大小。我的 InputStream 和 OutputStream 代码如下
package com.example.rama.beta;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import javax.crypto.Cipher;
import javax.crypto.CipherInputStream;
import javax.crypto.CipherOutputStream;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.spec.SecretKeySpec;
import android.app.Activity;
import android.os.Bundle;
import android.os.Environment;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button encryptButton = (Button) findViewById(R.id.button1);
Button DecryptButton = (Button) findViewById(R.id.button2);
encryptButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
try {
encrypt();
} catch (InvalidKeyException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (NoSuchPaddingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
});
DecryptButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
try {
decrypt();
} catch (InvalidKeyException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (NoSuchPaddingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
});
}
static void encrypt() throws IOException, NoSuchAlgorithmException,
NoSuchPaddingException, InvalidKeyException {
File extStore = Environment.getExternalStorageDirectory();
FileInputStream fis = new FileInputStream(extStore + "/abc.m4v");
FileOutputStream fos = new FileOutputStream(extStore + "/encabc.m4v");
SecretKeySpec sks = new SecretKeySpec("xxxx".getBytes(),
"AES");
Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.ENCRYPT_MODE, sks);
CipherOutputStream cos = new CipherOutputStream(fos, cipher);
int read;
byte[] buffer = new byte[1024];
while ((read = fis.read(buffer)) != -1) {
cos.write(buffer, 0, read);
}
cos.flush();
cos.close();
fis.close();
}
static void decrypt() throws IOException, NoSuchAlgorithmException,
NoSuchPaddingException, InvalidKeyException {
File extStore = Environment.getExternalStorageDirectory();
FileInputStream fis = new FileInputStream(extStore + "/encabc.m4v");
FileOutputStream fos = new FileOutputStream(extStore + "/decabc.m4v");
SecretKeySpec sks = new SecretKeySpec("xxxx".getBytes(),
"AES");
Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.DECRYPT_MODE, sks);
CipherInputStream cis = new CipherInputStream(fis, cipher);
int read;
byte[] buffer = new byte[1024];
while ((read = cis.read(buffer)) != -1) {
fos.write(buffer, 0, read);
}
fos.flush();
fos.close();
cis.close();
}
}
我使用的两个 Android 设备之间的显着区别是 RAM,该应用程序在具有 2gb RAM 的设备上处理 50mb 视频时完美运行,但在具有 1gb RAM 的设备上崩溃。我不确定这是 RAM 问题还是其他问题。感谢任何输入。
06-24 18:21:08.179 D/PhoneWindowManager(1760): mFullScreenIsEnable = true, mAlwaysFullScreen = false\par
06-24 18:21:08.179 I/ActivityManager(1760): START u0 \{act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10304000 cmp=com.example.rama.beta/.MainActivity\} from pid 1989\par
06-24 18:21:08.349 D/dalvikvm(20695): Late-enabling CheckJNI\par
06-24 18:21:08.349 I/ActivityManager(1760): Start proc com.example.rama.beta for activity com.example.rama.beta/.MainActivity: pid=20695 uid=10046 gids=\{50046, 1015, 1028\}\par
06-24 18:21:08.379 D/PhoneWindowManager(1760): mFullScreenIsEnable = true, mAlwaysFullScreen = false\par
06-24 18:21:08.419 E/SurfaceFlinger(1238): ro.sf.lcd_density must be defined as a build property\par
06-24 18:21:08.439 I/qtaguid (1760): Failed write_ctrl(s 1 10046) res=-1 errno=1\par
06-24 18:21:08.439 W/NetworkManagementSocketTagger(1760): setKernelCountSet(10046, 1) failed with errno -1\par
06-24 18:21:08.439 D/PhoneWindowManager(1760): mFullScreenIsEnable = true, mAlwaysFullScreen = false\par
06-24 18:21:08.449 E/SurfaceFlinger(1238): ro.sf.lcd_density must be defined as a build property\par
06-24 18:21:08.459 D/PhoneWindowManager(1760): mFullScreenIsEnable = true, mAlwaysFullScreen = false\par
06-24 18:21:08.469 D/PhoneWindowManager(1760): mFullScreenIsEnable = true, mAlwaysFullScreen = false\par
06-24 18:21:08.479 E/Trace (20695): error opening trace file: No such file or directory (2)\par
06-24 18:21:08.649 D/PhoneWindowManager(1760): mFullScreenIsEnable = true, mAlwaysFullScreen = false\par
06-24 18:21:08.669 E/SurfaceFlinger(1238): ro.sf.lcd_density must be defined as a build property\par
06-24 18:21:08.679 D/libEGL (20695): loaded /system/lib/egl/libEGL_mali.so\par
06-24 18:21:08.679 D/libEGL (20695): loaded /system/lib/egl/libGLESv1_CM_mali.so\par
06-24 18:21:08.679 D/libEGL (20695): loaded /system/lib/egl/libGLESv2_mali.so\par
06-24 18:21:08.719 W/BufferQueue(1238): freeAllBuffersLocked called but mQueue is not empty\par
06-24 18:21:08.749 D/OpenGLRenderer(20695): Enabling debug mode 0\par
06-24 18:21:08.929 I/ActivityManager(1760): Displayed com.example.rama.beta/.MainActivity: +599ms\par
06-24 18:21:11.089 I/dalvikvm(20695): Total arena pages for JIT: 11\par
06-24 18:21:11.089 I/dalvikvm(20695): Total arena pages for JIT: 12\par
06-24 18:21:11.099 I/dalvikvm(20695): Total arena pages for JIT: 13\par
06-24 18:21:11.099 I/dalvikvm(20695): Total arena pages for JIT: 14\par
06-24 18:21:11.099 I/dalvikvm(20695): Total arena pages for JIT: 15\par
06-24 18:21:11.099 I/dalvikvm(20695): Total arena pages for JIT: 16\par
06-24 18:21:11.099 I/dalvikvm(20695): Total arena pages for JIT: 17\par
06-24 18:21:11.129 I/dalvikvm(20695): Total arena pages for JIT: 18\par
06-24 18:21:11.999 D/dalvikvm(20695): GC_CONCURRENT freed 1832K, 40% free 4175K/6880K, paused 3ms+2ms, total 35ms\par
06-24 18:21:12.729 D/dalvikvm(20695): GC_CONCURRENT freed 1947K, 41% free 4175K/7028K, paused 3ms+3ms, total 19ms\par
06-24 18:21:13.649 D/dalvikvm(20695): GC_CONCURRENT freed 1952K, 41% free 4172K/7036K, paused 3ms+2ms, total 34ms\par
06-24 18:21:14.419 D/dalvikvm(20695): GC_CONCURRENT freed 1925K, 41% free 4197K/7036K, paused 2ms+1ms, total 26ms\par
06-24 18:21:15.159 D/dalvikvm(20695): GC_CONCURRENT freed 1985K, 41% free 4172K/7068K, paused 2ms+2ms, total 37ms\par
06-24 18:21:16.019 D/dalvikvm(20695): GC_CONCURRENT freed 1950K, 41% free 4194K/7068K, paused 3ms+52ms, total 77ms\par
06-24 18:21:16.049 D/dalvikvm(1760): GC_CONCURRENT freed 2590K, 30% free 12059K/17108K, paused 3ms+37ms, total 223ms\par
06-24 18:21:17.489 D/dalvikvm(20695): GC_CONCURRENT freed 1969K, 41% free 4175K/7068K, paused 3ms+3ms, total 18ms\par
06-24 18:21:17.869 I/InputDispatcher(1760): Application is not responding: Window\{41b2f780 u0 com.example.rama.beta/com.example.rama.beta.MainActivity\}. It has been 5006.0ms since event, 5005.6ms since wait started. Reason: Waiting because the touched window has not finished processing the input events that were previously delivered to it.\par
06-24 18:21:17.879 D/InputManager-JNI(1760): notifyANR\par
06-24 18:21:17.879 I/WindowManager(1760): Input event dispatching timed out sending to com.example.rama.beta/com.example.rama.beta.MainActivity\par
06-24 18:21:17.929 I/Process (1760): Sending signal. PID: 20695 SIG: 3\par
06-24 18:21:17.929 I/dalvikvm(20695): threadid=3: reacting to signal 3\par
06-24 18:21:17.949 I/dalvikvm(20695): Wrote stack traces to '/data/anr/traces.txt'\par
06-24 18:21:17.949 I/Process (1760): Sending signal. PID: 1760 SIG: 3\par
06-24 18:21:17.949 I/dalvikvm(1760): threadid=3: reacting to signal 3\par
06-24 18:21:17.979 D/dalvikvm(20695): GC_CONCURRENT freed 1208K, 41% free 4171K/7068K, paused 1ms+4ms, total 29ms\par
06-24 18:21:18.189 I/Process (1760): Sending signal. PID: 1989 SIG: 3\par
06-24 18:21:18.189 I/dalvikvm(1989): threadid=3: reacting to signal 3\par
06-24 18:21:18.189 I/dalvikvm(1760): Wrote stack traces to '/data/anr/traces.txt'\par
06-24 18:21:18.199 I/Process (1760): Sending signal. PID: 2171 SIG: 3\par
06-24 18:21:18.199 I/dalvikvm(2171): threadid=3: reacting to signal 3\par
06-24 18:21:18.259 I/dalvikvm(2171): Wrote stack traces to '/data/anr/traces.txt'\par
06-24 18:21:18.259 I/Process (1760): Sending signal. PID: 2180 SIG: 3\par
06-24 18:21:18.259 I/dalvikvm(2180): threadid=3: reacting to signal 3\par
06-24 18:21:18.259 D/ConnectivityService(1760): special network not available ni=mobile_hipri\par
06-24 18:21:18.279 I/dalvikvm(1989): Wrote stack traces to '/data/anr/traces.txt'\par
06-24 18:21:18.349 I/dalvikvm(2180): Wrote stack traces to '/data/anr/traces.txt'\par
06-24 18:21:18.439 D/dalvikvm(1760): GC_CONCURRENT freed 890K, 30% free 12146K/17108K, paused 17ms+15ms, total 252ms\par
06-24 18:21:18.669 D/dalvikvm(1760): GC_EXPLICIT freed 464K, 29% free 12316K/17108K, paused 5ms+10ms, total 98ms\par
06-24 18:21:18.919 D/dalvikvm(20695): GC_CONCURRENT freed 1944K, 41% free 4173K/7068K, paused 3ms+3ms, total 18ms\par
06-24 18:21:19.209 I/Process (1760): Sending signal. PID: 18063 SIG: 3\par
06-24 18:21:19.209 I/dalvikvm(18063): threadid=3: reacting to signal 3\par
06-24 18:21:19.239 I/dalvikvm(18063): Wrote stack traces to '/data/anr/traces.txt'\par
06-24 18:21:19.249 E/ActivityManager(1760): ANR in com.example.rama.beta (com.example.rama.beta/.MainActivity)\par
06-24 18:21:19.249 E/ActivityManager(1760): Reason: keyDispatchingTimedOut\par
06-24 18:21:19.249 E/ActivityManager(1760): Load: 1.09 / 1.36 / 1.55\par
06-24 18:21:19.249 E/ActivityManager(1760): CPU usage from 6504ms to 0ms ago:\par
06-24 18:21:19.249 E/ActivityManager(1760): 83% 20695/com.example.rama.beta: 74% user + 8.7% kernel / faults: 1365 minor\par
06-24 18:21:19.249 E/ActivityManager(1760): 2.9% 1760/system_server: 2.1% user + 0.7% kernel / faults: 154 minor\par
06-24 18:21:19.249 E/ActivityManager(1760): 0% 1168/nand10: 0% user + 0% kernel\par
06-24 18:21:19.249 E/ActivityManager(1760): 1.3% 1238/surfaceflinger: 0% user + 1.3% kernel\par
06-24 18:21:19.249 E/ActivityManager(1760): 0% 19796/flush-93:80: 0% user + 0% kernel\par
06-24 18:21:19.249 E/ActivityManager(1760): 0.9% 1241/mediaserver: 0.3% user + 0.6% kernel\par
06-24 18:21:19.249 E/ActivityManager(1760): 0.6% 12373/kworker/u:4: 0% user + 0.6% kernel\par
06-24 18:21:19.249 E/ActivityManager(1760): 0.1% 1167/nftld: 0% user + 0.1% kernel\par
06-24 18:21:19.249 E/ActivityManager(1760): 0.3% 10516/kworker/0:0: 0% user + 0.3% kernel\par
06-24 18:21:19.249 E/ActivityManager(1760): 0% 785/hdmi proc: 0% user + 0% kernel\par
06-24 18:21:19.249 E/ActivityManager(1760): 0.1% 11380/logcat: 0.1% user + 0% kernel\par
06-24 18:21:19.249 E/ActivityManager(1760): 0.1% 13429/kworker/u:2: 0% user + 0.1% kernel\par
06-24 18:21:19.249 E/ActivityManager(1760): 0.1% 18063/com.nolanlawson.logcat: 0.1% user + 0% kernel / faults: 5 minor\par
06-24 18:21:19.249 E/ActivityManager(1760): +0% 20829/migration/1: 0% user + 0% kernel\par
06-24 18:21:19.249 E/ActivityManager(1760): +0% 20830/kworker/1:0: 0% user + 0% kernel\par
06-24 18:21:19.249 E/ActivityManager(1760): +0% 20831/ksoftirqd/1: 0% user + 0% kernel\par
06-24 18:21:19.249 E/ActivityManager(1760): +0% 20832/kworker/1:1: 0% user + 0% kernel\par
06-24 18:21:19.249 E/ActivityManager(1760): 0.-4% TOTAL: 0.-5% user + 0.-1% kernel\par
06-24 18:21:19.249 E/ActivityManager(1760): CPU usage from 763ms to 1283ms later:\par
06-24 18:21:19.249 E/ActivityManager(1760): 101% 20695/com.example.rama.beta: 98% user + 3.8% kernel / faults: 38 minor\par
06-24 18:21:19.249 E/ActivityManager(1760): 98% 20695/mple.rama.beta: 94% user + 3.8% kernel\par
06-24 18:21:19.249 E/ActivityManager(1760): 3.8% 20698/GC: 3.8% user + 0% kernel\par
06-24 18:21:19.249 E/ActivityManager(1760): 3.8% 1760/system_server: 0% user + 3.8% kernel / faults: 1 minor\par
06-24 18:21:19.249 E/ActivityManager(1760): 3.8% 1924/InputDispatcher: 0% user + 3.8% kernel\par
06-24 18:21:19.249 E/ActivityManager(1760): 1.9% 1781/ActivityManager: 0% user + 1.9% kernel\par
06-24 18:21:19.249 E/ActivityManager(1760): 1.4% 18063/com.nolanlawson.logcat: 1.4% user + 0% kernel / faults: 1 minor\par
06-24 18:21:19.249 E/ActivityManager(1760): 1.4% 18063/anlawson.logcat: 1.4% user + 0% kernel\par
06-24 18:21:19.249 E/ActivityManager(1760): 54% TOTAL: 48% user + 5.7% kernel\par
06-24 18:21:19.259 W/ActivityManager(1760): Force finishing activity com.example.rama.beta/.MainActivity\par
06-24 18:21:19.309 I/ActivityManager(1760): Killing ProcessRecord\{41ac6640 20695:com.example.rama.beta/u0a10046\}: user's request\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/InputDispatcher(1760): Dropping event because there is no touched window.\par
06-24 18:21:19.329 I/qtaguid (1760): Failed write_ctrl(s 0 10046) res=-1 errno=1\par
06-24 18:21:19.329 W/NetworkManagementSocketTagger(1760): setKernelCountSet(10046, 0) failed with errno -1\par
06-24 18:21:19.329 I/ActivityManager(1760): Process com.example.rama.beta (pid 20695) has died.\par
06-24 18:21:19.329 I/WindowState(1760): WIN DEATH: Window\{41b2f780 u0 com.example.rama.beta/com.example.rama.beta.MainActivity\}\par
最佳答案
正如预期的那样,您正在主 UI 线程上进行加密和解密。
@Override
public void onClick(View v) {
try {
encrypt();
} catch (InvalidKeyException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (NoSuchPaddingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
如果您的应用长时间无响应,就会发生这种情况,您可以在官方网站上阅读更多相关信息 google android page.
你必须在一个额外的线程中完成它们,例如使用 AsyncTask为了那个原因。使用异步任务的 doInBackground(...) {
方法进行加密/解密并在您的应用中显示进度指示器。然后在 onPostExecute(...)
方法中,您可以更新您的 UI(删除进度指示器并继续您的应用正在执行的操作)。
有各种关于如何使用异步任务的示例。喜欢here , here或 here are examples and information about background processes in android .
关于java - Android 应用程序在处理大文件时在某些设备上崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44739109/
我最近在/ 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 ') 如何
我是一名优秀的程序员,十分优秀!