开发者

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 ente开发者_如何转开发r 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!


Make sure and add your activity in AndroidManifest.xml.

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


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

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜