Code: Select all
private boolean aboutDialog() {
// TODO Auto-generated method stub
String vNo="";
try {
vNo=MainActivity.this.getPackageManager().getPackageInfo(MainActivity.this.getPackageName(), 0).versionName;
vNo = "\n\nVersion : " + vNo;
} catch (NameNotFoundException e) {
// TODO Auto-generated catch block
vNo="";
e.printStackTrace();
}catch (Exception e) {
vNo="";
e.printStackTrace();
}
AlertDialog.Builder alertbox = new AlertDialog.Builder(this);
alertbox.setTitle("About");
alertbox.setMessage("Developed by : Vivek.V\n\nEmail : vivek@androidappmasters.com"+vNo);
alertbox.setNeutralButton("OK", new DialogInterface.OnClickListener() {
// click listener on the alert box
public void onClick(DialogInterface arg0, int arg1) {
// the button was clicked
}
});
// show it
alertbox.show();
return true;
}
MainActivity.this.getPackageManager().getPackageInfo(MainActivity.this.getPackageName(), 0).versionName;
will return the version no of the application.