如何使用猴子工具的类别选项?
我的清单文件的相关部分如下所示:
<application android:icon="@drawable/icon" android:label="@string/app_name" android:name="MyApp" android:debuggable="true" android:allowBackup="false" android:testOnly="false">
<activity android:name="MyLauncherActivity" android:label="@string/app_name" android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="MyMainActivity" android:label="@string/app_name" android:screenOrientation="portrait">
<intent-filter>
<action android:name="none" />
<category android:name="android.intent.category.MONKEY" />
</intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)
我在手机上运行应用程序以确保它正常工作然后我在命令行输入:
adb shell monkey -p my.full.package.path -vvv 3
Run Code Online (Sandbox Code Playgroud)
它工作得很好.
但这不起作用:
adb shell monkey -p my.full.package.path -c intent.CATEGORY_LAUNCHER -vvv 3
Run Code Online (Sandbox Code Playgroud)
并产生以下输出:
:Monkey: seed=0 count=3
:AllowPackage: myapp.full.package.path
:IncludeCategory: intent.CATEGORY_LAUNCHER
// Warning: no activities found for category intent.CATEGORY_LAUNCHER
** No activities found to run, monkey aborted. …Run Code Online (Sandbox Code Playgroud) 我不明白何时触发ACTION_OUTSIDE.请举个例子.
文档给出了这个神秘的描述:
getAction()的常量:移动发生在UI元素的正常边界之外.这不提供完整的手势,而只提供移动/触摸的初始位置.
http://developer.android.com/reference/android/view/MotionEvent.html#ACTION_OUTSIDE
VMDebug.startGC在跟踪视图文件中有什么含义
该文件说:
/*
* Fake method, inserted into dmtrace output when the garbage collector
* runs. Not actually called.
*/
private static void startGC() {}
Run Code Online (Sandbox Code Playgroud)
但在我的traceview中,我看到这样的事情:
将鼠标悬停在棕色方块上表示它们是VMDebug.startGC()方法,每种方法大约需要17个实际ms.绿色方块是BitmapFactory.nativeDecodeAssetFunctions,它们每个大约需要26毫秒.在这段代码中,我将加载位图作为openGL纹理导入.
什么是startGC()函数?
我有一个基于函数名称和观察它的信念,当它调用它以某种方式与垃圾收集相关时,但文档与我相矛盾.
如何在我的代码中触发Android onCreateOptionsMenu函数,即用户无需点击手机上的选项菜单按钮?
openGL存储纹理多长时间?
离开活动时纹理内存是否会被回收?
例如,如果我有以下代码:
mGL.glGenTextures(1, mTextures, 0);
mGL.glBindTexture(GL10.GL_TEXTURE_2D, mTextures[0]); // A bound texture is
// an active texture
//mGL.glTexImage2D(GL10.GL_TEXTURE_2D, 0, GL10.GL_RGBA, bitmap.getWidth(),bitmap.getHeight(), 0, GL10.GL_RGBA, GL10.GL_FLOAT, textures);
GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0,GL10.GL_RGBA, bitmap, 0);
// create nearest filtered texture
mGL.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER,
GL10.GL_LINEAR); // This is where the scaling algorithms are
mGL.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER,
GL10.GL_LINEAR); // This is where the scaling algorithms are
mGL.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S,
GL10.GL_CLAMP_TO_EDGE);
mGL.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T,
GL10.GL_CLAMP_TO_EDGE);
GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);
//bitmap.recycle();
Log.v("GLSurfaceView", "Loading Texture Finished");
return mTextures[0];
Run Code Online (Sandbox Code Playgroud)
哪些更改会使返回值无效?
当我回到活动中时(我说这个人打过电话),我不想重新加载所有纹理,因为它确实减慢了速度.
更新:
在Renderer文档中找到此信息,该文档确认了@svdree下面给出的答案:
EGL上下文丢失在某些情况下,EGL渲染上下文将丢失.这通常发生在设备进入睡眠状态后唤醒时.当EGL上下文丢失时,将自动删除与该上下文关联的所有OpenGL资源(例如纹理).为了保持正确渲染,渲染器必须重新创建它仍然需要的任何丢失的资源.onSurfaceCreated(GL10,EGLConfig)方法是一个方便的地方.
这意味着纹理与EGL上下文相关
自发布此问题以来,我尝试通过让我的活动从具有对自定义GLRenderer的引用的基本活动继承来解决问题.基本上,我可以向前传递OpenGLSurface …
将命名空间重命名为其他东西的常见lisp方法是什么.所以不要写hunchentoot:start我可以写ht:start.
我正在寻找像pythons import A as B这样的东西.
编辑:使用接受的答案,为hunchentoot添加昵称的代码如下:
(rename-package :hunchentoot :hunchentoot '(:ht))
Run Code Online (Sandbox Code Playgroud) 有没有办法找到专门针对给定类型的所有函数?
我设想你可以从repl执行的东西(find-all-specializing-methods 'my-class),它将返回一个方法列表,如(mypackage1:my-method-1 my-package2:my-method-2 etc.)
我认为必须有一个简单的方法来做到这一点,因为MOP本身可能需要存储这样的列表来决定调用哪些方法.
是否有可能让android给我一个自定义ID?
例如,如果我已经在xml中定义:
R.id.some_layout
R.drawable.some_drawable
Run Code Online (Sandbox Code Playgroud)
有没有像这样的功能
R.custom_id("a_custom_id")
Run Code Online (Sandbox Code Playgroud)
所以我可以访问
R.id.a_custom_id
Run Code Online (Sandbox Code Playgroud)