I dont know what I am doing wrong. I am trying to launch an activity of another app from current app.
Here is the code:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setComponent(new ComponentName("com.second.package","com.second.package.SecondActivity"));
startActivity(intent);
}
When I run this thing it says Application closed unexpectedly. What is wrong? Please help me.
Succeded: Just add :
android.intent.category.DEFAULT
to the activity in the manifest file.
try as: