JDelonge
JDelonge

Reputation: 315

Android - New Window

So I want a user to input two strings (name and email, let's say) to add a contact. I'm really struggling with it.

I've created an 'addPerson' class where I wanted to set this up, so I call it like this:

Intent intent = new Intent(this, addPerson.class);
startActivity(intent);
// ^ startActivityForResult(intent, 1)

It always crashes here, and I think the problem is when I enter my next addPerson class.

public class addPerson extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
}

I know this is something so simple but I've wasted hours of trying to research it, all the examples are either too simple or too complex. Thanks!

Upvotes: 0

Views: 1571

Answers (2)

Corey Sunwold
Corey Sunwold

Reputation: 10254

Did you add your second activity to the AndroidManifest.xml?

<activity android:name=".addPerson"
                android:label="Add Person"></activity>

Upvotes: 1

Ryan Reeves
Ryan Reeves

Reputation: 10229

Make sure and add your activity in AndroidManifest.xml.

<activity android:name=".addPerson"></activity>

Upvotes: 2

Related Questions