On clicking a button to migrate to another activity, the app crashes and log shows:
java.lang.IllegalStateException: Could not execute method for android:onC
The key part of the full stack trace is found here:
Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.unholyalliance.infinitestream/com.example.unholyalliance.infinitestream.Host}; have you declared this activity in your AndroidManifest.xml
It appears you do not have this Host activity declared in your manifest file. Open AndroidManifest.xml and check for or add the following:
<activity
android:name=".Host" />
Also make sure you fix the issue in Host to first only declare your TextView and then assign the value in onCreate() after setContentView().
private TextView service_status;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_host);
service_status = (TextView) findViewById(R.id.textView1);
...
}
Check your Parcelable objects or Serializable objects that are putted intent whether is correct. Inspect carefully subclasses and add essential interfaces (Serializable or Parcelable) if you need.
Above answers are correct, but also double check to register your class in Manifest.
<activity android:name=".Downloaded"
android:label="@string/app_name">
</activity>
.Downloaded is your class name above.
Make sure that your onClick in Button view in activity_main.xml is like this android:onClick="host"
Example:
<Button
android:id="@+id/main_activity_bt_host"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/host"
android:onClick="host" />