【发布时间】:2010-09-20 03:50:17
【问题描述】:
我正在编写一个非常小的应用程序,它只打开准备好视频的相机应用程序。我可以让我的代码在 Android 2.2 模拟器上运行,但它无法在我的设备 Motorola Droid 1 stock 2.2 FRG22D 上运行。有什么想法我在这段代码上出错了吗?
public class StartVid extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final int VIDEO = 1;
Intent intent = new Intent();
intent.setClassName("com.android.camera","com.android.camera.VideoCamera");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivityForResult(intent, VIDEO );
finish();
看来ThorstenW 是正确的。如果我有足够的代表,我会赞成你的回答。从logcat中可以看到com.android.camera 找不到并抛出了一个致命的异常。下面是 Logcat。
D/dalvikvm(1159):GC_EXTERNAL_ALLOC 在 66 毫秒内释放了 251 个对象/13456 个字节 I/ActivityManager(1086):开始活动:Intent { act=android.intent.action。 主猫=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.goatpen.Phobo s.QSVideo/.StartVid } I/ActivityManager(1086): 为活动 com 启动 proc com.goatpen.Phobos.QSVideo .goatpen.Phobos.QSVideo/.StartVid: pid=483 uid=10092 gids={}
E/AndroidRuntime(483): java.lang.RuntimeException: Unable to start activity Co mponentInfo{com.goatpen.Phobos.QSVideo/com.goatpen.Phobos.QSVideo.StartVid}:和 roid.content.ActivityNotFoundException:找不到明确的活动类{ com.android.camera/com.android.camera.VideoCamera};你宣布这个活动了吗 您的 AndroidManifest.xml 中的内容?
E/AndroidRuntime(483):原因:android.content.ActivityNotFoundException:U 无法找到明确的活动类 {com.android.camera/com.android.camera.Vid 相机};您是否在 AndroidManifest.xml 中声明了此活动?
【问题讨论】:
-
能贴一下你的摩托罗拉生成的logcat吗?
标签: android video permissions camera android-intent