- // Convert the file name string to a file.
- val file = File(fileNameString)
-
- // Check to see if the file exists.
- if (file.exists()) { // The file exists.
- // Hide the notification that the file does not exist.
- fileDoesNotExistTextView.visibility = View.GONE
-
- // Enable the open button.
- openButton.isEnabled = true
- } else { // The file does not exist.
- // Show the notification that the file does not exist.
- fileDoesNotExistTextView.visibility = View.VISIBLE
-
- // Disable the open button.
- openButton.isEnabled = false
- }
+ // Enable the open button if the file name is populated.
+ openButton.isEnabled = fileNameString.isNotEmpty()