Tag: 安卓

应该“android:onOptionsItemSelected”返回true或false

在onOptionsItemSelected中…我看到了一些代码在开关块中是不同的。 情况1(通常可见) public boolean onOptionsItemSelected (MenueItem item) switch (item.getItemId()){ case R.id.item1: startActivity (new Intent (this, PrefsActivity.class)); break; } return true 案例2(不确定为什么这样设置) public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case MENU_NEW_GAME: newGame(); return true; } return false; 我的问题 案例1和案例2有什么区别?

Android密钥库的位置好吗?

有没有关于Android密钥库“应该”位置的指南? 我准备发布我的第一个应用程序,并在导出Android应用程序我正在创build一个新的密钥库,它要我指定的位置。 FWIW我的Eclipse Workspace在共享的networking驱动器上,我可以从3种不同的开发系统中访问它。 我没有这样做的问题。 密钥库位置的默认位置似乎在SDK目录树中,但这对我不起作用,因为每个PC都有自己的SDK安装副本。 我需要它在一个可以从任何PC上看到的位置,我可能正在从事开发工作,所以我假设这意味着networking驱动器或云中的某个虚拟位置。 我需要知道关于密钥库的位置的准则,规则,限制或其他事情吗?

Genymotion如何使用Chrome开发工具进行debugging

我们正在使用Genymotion来testing/debugging基于WebView的Android应用程序。 该设备通过检测设备显示在Chrome开发工具中,但没有检测能力。 我们做了不同的尝试,使用/缺lessAndroid Studio,但没有运气。 有什么不对?

拼写检查android studio / IntelliJ的想法

我一直在使用西class牙语的Android Studio,它让我困扰,它突出显示拼写正确的不正确的单词。 我可以添加一个西class牙字典到Android Studio或我的IntelliJ的想法?

错误:Android源生成器:找不到AndroidManifest.xml文件

我是Android的新手,使用intellij的想法。 当我想编译我的hello-world(第一步;))我遇到了这个错误“Android源生成器:[项目] AndroidManifest.xml文件没有find” 当然这不是在我的根文件。 而当我做出新的项目时,我也有同样的问题。 我search了很多,甚至发现这个“ AndroidManifest.xml文件没有find ”,但没有帮助。 PLZ的帮助。

Android Studio 3.0错误。 迁移本地模块的依赖configuration

我最近安装了目前使用Android Gradle插件3.0.0-alpha4的Android Studio的最新Canary版本。 我现在得到一个错误: Error:Failed to resolve: Could not resolve project :MyLib. Required by: project :app 我读过: 迁移本地模块的依赖configuration dependencies { // This is the old method and no longer works for local // library modules: // debugCompile project(path: ':foo', configuration: 'debug') // releaseCompile project(path: ':foo', configuration: 'release') // Instead, simply use the following to take […]

扩展AsyncTask <Void,Void,Void>

在我的Android应用程序中,我通过扩展AsyncTask<Void, Void, Void>类在doInBackground执行一些操作。 (我没有用这个类来执行任何UI) 这是AsyncTask的正确使用吗? 如果是的话,我可以扩展AsyncTask吗? 扩展AsyncTask和AsyncTask<Void, Void, Void>之间有什么区别? 代码示例: public class MessagePooling extends AsyncTask<Void, Void, Void> { @Override protected Void doInBackground(Void… params) { while (!isCancelled()) { //Getting data from server SystemClock.sleep(1000); } return null; } } 要么: public class MessagePooling extends AsyncTask { @Override protected Object doInBackground(Object… params) { while (!isCancelled()) { //Getting data […]

GooglePlayServicesUtil.getErrorDialog为null

我正在使用ACRA( arca.ch )来生成自动错误报告。 我刚刚使用Google Maps Android API v2发布了我的应用程序的新版本。 当试图显示由GooglePlayServicesUtil.getErrorDialog返回的对话框时,EEEPad和Transformer Pad用户报告了错误。 有谁知道为什么会发生这种情况? 以下是acra报告的相关代码和Logcat: 在调用这一行时: int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this); if(resultCode != ConnectionResult.SUCCESS) { //The dialog that comes back is null (probably due to the logcat message) Dialog dialog = GooglePlayServicesUtil.getErrorDialog(resultCode, this, 69); //So when I call the next line, the app crashes with a NullPointerException dialog.show(); } […]

Android:如何在模拟器中使用摄像头?

通过在AVDpipe理器中将前置摄像头设置为“webcam0”,我将一个networking摄像头连接到我的仿真器。 当我启动模拟器的相机应用程序,我得到错误 CameraService::connect X (pid 702) rejected (invalid cameraId 0). 以下是Android源代码的相关部分: sp<ICamera> CameraService::connect( const sp<ICameraClient>& cameraClient, int cameraId) { int callingPid = getCallingPid(); […] if (cameraId < 0 || cameraId >= mNumberOfCameras) { LOGE("CameraService::connect X (pid %d) rejected (invalid cameraId %d).", callingPid, cameraId); return NULL; } […] } 因为只有一个摄像头,networking摄像头已被正确分配了ID。 但是, mNumberOfCameras大概仍然是0.这意味着相机正在被模拟器注册,但是没有更新连接的相机的数量。 如何连接networking摄像头以便模拟器能够正确识别? 编辑: \android-sdks\tools的命令emulator -webcam-list […]

Android Firebase,只需获取一个子对象的数据

我一直在寻找一种方法在Android Firebase中获取一个子对象的数据。 我已经find像Firebase检索子Android的东西。 所有的解决scheme都build议使用“ChildEventListener”,但是我现在需要获取这些数据,而不是在移动,删除,更新等情况下。 我的数据作为string保存在https://.firebaseio.com/users//creation中。 我觉得必须有一些简单的方法来访问,而不需要做太多,因为如果我将确切的URL复制到我的浏览器,我可以看到:'创build:“2015/05/31 21:33:55”'就在我的“Firebase Forge仪表板”中。 如果有人知道如何访问这个没有听众的变化,将不胜感激! 谢谢!