Intent intent = new Intent();
ComponentName componentName = new ComponentName("com.iotek.ListviewGesture", "com.iotek.ListviewGesture.ListviewGestureActivity");
intent = new Intent(Intent.ACTION_MAIN);
intent.setComponent(componentName);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
// startActivitySafely(intent, null);
ComponentName componentName = new ComponentName("com.iotek.ListviewGesture", "com.iotek.ListviewGesture.ListviewGestureActivity");
intent = new Intent(Intent.ACTION_MAIN);
intent.setComponent(componentName);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
// startActivitySafely(intent, null);

本文提供了一段详细的代码示例,展示了如何在Android应用中使用Intent启动指定的Activity。通过设置组件名称、操作类型、类别及标志位,确保目标Activity能够被正确调起。
981

被折叠的 条评论
为什么被折叠?



