Example #1
0
  public void initButton() {
    boolean installed = Utils.appInstalledOrNot(this, NEWSPLUS_PACKAGE);
    if (installed) mAppPackage = NEWSPLUS_PACKAGE;
    else {
      installed = Utils.appInstalledOrNot(this, NEWSPLUS_PRO_PACKAGE);
      if (installed) mAppPackage = NEWSPLUS_PRO_PACKAGE;
    }

    Button button = (Button) findViewById(R.id.btn_ok);
    button.setText(installed ? R.string.txt_start_app : R.string.txt_download_app);
    button.setEnabled(true);
    button.setOnClickListener(this);
  }
Example #2
0
 @Override
 public void onClick(View v) {
   switch (v.getId()) {
     case R.id.btn_ok:
       if (TextUtils.isEmpty(mAppPackage)) {
         Utils.startMarketApp(this, NEWSPLUS_PACKAGE);
       } else {
         Utils.startAppPackage(this, mAppPackage);
         finish();
       }
       break;
   }
 }