0

I tried to use intent like this on ticwatch pro. However, the application stopped. I want some information about this.

This code is in MainActivity

Intent intent = new Intent(MainActivity.this, TestActivity.class);
            startActivity(intent);

This code is in TestActivity

public class TestActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_test);

        Intent intent = getIntent();
    }
}

This code is activity_test.xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".TestActivity">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="hello"/>

</android.support.constraint.ConstraintLayout>
2lu3
  • 1
  • There are some problem solving instruction under [Unfortunately MyApp has stopped. How can I solve this?](https://stackoverflow.com/questions/23353173/unfortunately-myapp-has-stopped-how-can-i-solve-this). The stack trace will explain the problem. – Markus Kauppinen Aug 15 '18 at 11:51
  • Have you declared your TestActivity in the manifest file? Please post the stack trace from Logcat when the app crashes. – TofferJ Aug 15 '18 at 17:30
  • I forget to declare TestActivity in the manifest file Thank you for that – 2lu3 Aug 16 '18 at 04:47

0 Answers0