title: Detect installed certificate in my android device
body: <p>I am installing a certificate in my application when application starts. I have gone through few of the links as below and successfully install the certificate.</p>
  
  <ul>
  <li><p><a href="http://nelenkov.blogspot.in/2011/12/ics-trust-store-implementation.html" rel="nofollow noreferrer">http://nelenkov.blogspot.in/2011/12/ics-trust-store-implementation.html</a></p></li>
  <li><p><a href="http://pastebin.com/Bn6qSYHx" rel="nofollow noreferrer">http://pastebin.com/Bn6qSYHx</a></p></li>
  <li><p><a href="https://stackoverflow.com/questions/9024721/how-to-programmatically-install-a-ca-certificate-for-eap-wifi-configuration-in">How to programmatically install a CA Certificate (for EAP WiFi configuration) in Android?</a></p></li>
  <li><p><a href="https://stackoverflow.com/questions/11657172/how-to-install-ca-certificate-programmatically-on-android-without-user-interacti">how to install CA certificate programmatically on Android without user interaction</a></p></li>
  </ul>
  
  <p>I came to know we cannot install the certificate silently without user interaction.Currently I don't know how to stop prompt each time user open my app.</p>
  
  <p>Whenever my application starts currently every time it ask user to install certificate. Is there some way I can detect whether a certificate(in this case my certificate) is already installed or not, programmatically.</p>
  
  <p>Code snippet where I have installing certificate in my app</p>
  
  <pre><code>private void installCertificate()
      {
          try 
          {
              BufferedInputStream bis = new BufferedInputStream(getAssets().open(MY_CERT));
              byte[] keychain = new byte[bis.available()];
              bis.read(keychain);
  
              Intent installIntent = KeyChain.createInstallIntent();
              X509Certificate x509 = X509Certificate.getInstance(keychain);
              installIntent.putExtra(KeyChain.EXTRA_CERTIFICATE, x509.getEncoded());
              installIntent.putExtra(KeyChain.EXTRA_NAME, MY_CERT);
              startActivityForResult(installIntent, INSTALL_KEYCHAIN_CODE);
          }
          catch (IOException e) {
              e.printStackTrace();
          }
          catch (CertificateException e) 
          {
              e.printStackTrace();
          }
      }
  
      @Override
      protected void onActivityResult(int requestCode, int resultCode, Intent data) 
      {
          if (requestCode == INSTALL_KEYCHAIN_CODE) 
          {
              switch (resultCode) 
              {  
                  case Activity.RESULT_OK:
                      doTheTask();
                      break;
                  case Activity.RESULT_CANCELED:
                      finish();
                      break;                  
                  default:
                      super.onActivityResult(requestCode, resultCode, data);
              }
          }
      }
  </code></pre>
  
  <p>Also FYI, installCertificate() is called from onCreate(). </p>
  
  <p>Please help me out for the same. Any help will appreciated.</p>
  
  <hr>
  
  <p><strong>Query:</strong> When prompt comes for certificate name, entered text comes as selected and on orientation change cut/copy option comes. Any body knows how to stop text selection when prompt comes?!!!</p>