a3deluxe Posted February 19, 2016 at 10:52 AM Report Share #593676 Posted February 19, 2016 at 10:52 AM Bom dia, Precisava de uma ajudinha, queria colocar no meu programa uma pen USB para abrir uma determinada janela, Quando coloca-se a pen drive ele abrir a janela com.gambling.h.CredScreen Quando retira-se a pen drive abria a janela com.gambling.h.MainActivity -------------------------------------------------------------------- coloquei este mas não funcionou: //String path = "/mnt/sdcard/result.xml"; String path = "/mnt/usb_storage/result.xml"; File file2 = new File(path); if (null != file2) { if(file2.exists()) { <activity android:name="com.gambling.h.CredScreen" /> } else { <activity android:name="com.gambling.h.MainActivity" /> } } Mas queria usar outro método, porque este método procura na directoria especifica, isto não é bom porque se for para instalar a vários tablat não funciona porque as directorias da usb variam consoante o tablet. Queria por exemplo fazer como em VB.net, procura pela pen drive. não usa directório ou Letra da unidade.(exemplo em baixo) Dim encontrou As Boolean = False For Each drive As DriveInfo In DriveInfo.GetDrives() If File.Exists(String.Format("{0}file.txt", drive.Name)) Then form1.Show() End If Next If Not encontrou Then form1.Close() End If Obrigado Link to comment Share on other sites More sharing options...
a3deluxe Posted February 25, 2016 at 01:41 PM Author Report Share #593849 Posted February 25, 2016 at 01:41 PM niniguem para dar uma ajudinha? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now