开发者

How to create single button Dialog in android?

开发者 https://www.devze.com 2023-02-20 07:12 出处:网络
I have been searching for days trying to figure out how to add dialog with sin开发者_高级运维gle button in my application. Thanks in advance!The Dialog is simple, or is the question how to determine i

I have been searching for days trying to figure out how to add dialog with sin开发者_高级运维gle button in my application. Thanks in advance!


The Dialog is simple, or is the question how to determine if a update is nessecary? Here the Dialogbuilder:

AlertDialog.Builder builder = new AlertDialog.Builder(FisMapView.this);
                        builder.setTitle("Update required");
                        builder.setPositiveButton("UPDATE", new DialogInterface.OnClickListener() {                     
                            @Override
                            public void onClick(DialogInterface dialog, int which) {

                            } 
                        });

                        builder.setNeutralButton("Abort", null);
                        AlertDialog alert = builder.create();
                        alert.show();

edit: I can't figure out how to check for updates in the market, i would suggest to compare the version with a website of your own, if you increase the versionnumber on this site, call the market to download the newest version or download the apk externally


Store the current version in your apps defaultsharedpreferences. Have a variable on your main activity which you increment when you increment the version in the manifest. During run, have it check the current with the version in the code and do something if the new one is higher. Then update the one in the preferences.

EDIT:

If they hit cancel on the dialog, have the program end so they are forced to see it every time they open it until they run the update.

0

精彩评论

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