开发者

How to set new window

开发者 https://www.devze.com 2023-02-26 01:32 出处:网络
I am thinking, how to set up the new window in Android after pressed button. I have the first window, when I have a few buttons. After pressed one of these buttons (for example on the button for addin

I am thinking, how to set up the new window in Android after pressed button. I have the first window, when I have a few buttons. After pressed one of these buttons (for example on the button for adding new name) I want to show new window, when will be only Edit text for new name.开发者_StackOverflow..

Any ideas, how is possible to do or where to search inspiration?

Thanks a lot, Manny


You need to start new activity.

    Intent i = new Intent(ActualActivity.this,ActivityB.class);
    String name = "example"
    i.putExtra("NAME", name);
    startActivityForResult(i, ID);//or startActivity,see javadoc for your preferences

With "startActivity" or "startActivityForResult" you call the new activity. For that you need to create a "Intent". If you want to send information like a name, or a number or something else you can "putExtra" information like the example. (Ofc ActivityB must to extend Activity and must be declare in AndroirManifest)

EDIT: You have a lot of example of how to start new activity in the SDK examples (sdk directory/samples/android X )

0

精彩评论

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