Click here to Skip to main content
15,867,835 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I try this code to show the list of alias recorded in AndroidKeyStore .But nothing is displayed in the listview.Somebody has an idea about what's wrong in the code !
ArrayList<String> alia= new ArrayList<String>();
try{
    KeyStore ks = KeyStore.getInstance("AndroidKeyStore");
    ks.load(null);
    Enumeration<String> aliases = ks.aliases();   
    while(aliases.hasMoreElements()) {
      String alias= aliases.toString();
        alias = (String)aliases.nextElement();
        alia.add(alias);     
    }
}
catch (java.security.cert.CertificateException e) {
    e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
    e.printStackTrace();
} catch (FileNotFoundException e) {
    e.printStackTrace();
} catch (KeyStoreException e) {
    e.printStackTrace();
} catch (IOException e) {
   e.printStackTrace();
}

ArrayAdapter<String> adapter=new ArrayAdapter<String>(MainActivity.this,android.R.layout.simple_expandable_list_item_1,alia);
listView.setAdapter(adapter);
Posted
Comments
Richard MacCutchan 29-May-15 12:32pm    
Try without the ks.load statement.
Member 11683950 29-May-15 13:20pm    
why i should delete this line !
Richard MacCutchan 29-May-15 13:45pm    
Try it and see what happens.
Member 11683950 29-May-15 13:55pm    
nothing happen it still the same problem !
Richard MacCutchan 30-May-15 3:29am    
Then you need to use your debugger to see what is happening. Are you sure that you get a valid keystore in the first place, does it contain any entries ...?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900