Skip to content Skip to sidebar Skip to footer

Could Not Find Class When Application Is Loaded Into Emulator

I have an activity (DemoAppActivity) from which I am trying to launch a different activity (MainActivity) when a button is pressed. However I am getting two errors: 1) when the ap

Solution 1:

I was able to figure it out from another post. Basically you need to do this with the Intent before starting the activity:

Intenti=newIntent();
i.setComponent(newComponentName("com.example.android.hcgallery", "com.example.android.hcgallery.MainActivity"));
startActivity(i);

The setComponent tells the class loader to make it available. After adding that code, it worked!

Post a Comment for "Could Not Find Class When Application Is Loaded Into Emulator"