fix: search: crash on unable to open
This commit is contained in:
parent
c3d8f75ee6
commit
36ccbadb7d
1 changed files with 6 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
||||||
package com.dazuoye.filemanager.compose.ui
|
package com.dazuoye.filemanager.compose.ui
|
||||||
|
|
||||||
|
import android.content.ActivityNotFoundException
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
|
@ -195,7 +196,11 @@ class SearchFileColumn(
|
||||||
val intent = Intent(Intent.ACTION_VIEW)
|
val intent = Intent(Intent.ACTION_VIEW)
|
||||||
intent.setDataAndType(uri, WrappedFile(file).mime)
|
intent.setDataAndType(uri, WrappedFile(file).mime)
|
||||||
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
||||||
context.startActivity(intent)
|
try {
|
||||||
|
context.startActivity(intent)
|
||||||
|
}catch (e: ActivityNotFoundException){
|
||||||
|
Toast.makeText(context,"无打开此应用的程序", Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue