开发者

Android:Java, Alert on same Page

Hi Guys How could I do this Alert on the same Page without "reloading" this page? This one here "reload" the page and that do not show so fine.

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

    // Bündel extras erstellen, mit den Werten von "putExtras" (aus FormularActivity)
    final Bundle extras = getIntent().getExtras();  

    AlertDialog.Builder alertbox = new AlertDialog.Builder(this);
    alertbox.setMessage("Nettobetrag: " + "\t\t" + strNetto + "\n" + "Umsatzsteuer: " + "\t\t" + strUmsa开发者_运维知识库tz + "\n" + "Nettobetrag: " + "\t\t" + strBrutto);
    alertbox.setNeutralButton("Ok", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface arg0, int arg1) {

            startActivity(new Intent("com.mseiz.ustcalc.splashscreen.FormularActivity"));
        }
    });
    alertbox.show();


In general, it's best to do the following for any type of dialog. Use a showDialog(int) command to show the dialog, where int is any unique number. You can have as many dialogs as you wish, they just all need to have their own number. The second step is to add a function called onCreateDialog() to your activity, which contains the instructions to build the dialog. The SDK has some good examples of how you should go about doing this.

public Dialog onCreateDialog(int dialog_num)
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜