Advertisement
Sketchware

Procurar uma 📂 dentro diretório celular usando edittext button

Jan 20th, 2023
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.46 KB | None | 0 0
  1. EditText directoryEditText = findViewById(R.id.directoryEditText);
  2. String directoryName = directoryEditText.getText().toString();
  3. File dir = new File(Environment.getExternalStorageDirectory() + "/" + directoryName);
  4. if(dir.exists() && dir.isDirectory()) {
  5.     Toast.makeText(getApplicationContext(), "existe uma pasta com esse nome", Toast.LENGTH_SHORT).show();
  6. } else {
  7.     Toast.makeText(getApplicationContext(), "pasta não existe", Toast.LENGTH_SHORT).show();
  8. }
  9.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement