Skip to content
This repository has been archived by the owner on Mar 4, 2022. It is now read-only.

Commit

Permalink
Try Fix #9302 java.io.FileNotFoundException
Browse files Browse the repository at this point in the history
  • Loading branch information
itning committed Feb 25, 2019
1 parent 9cbd4bf commit 48bc54d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,11 @@ class ShareActivity : BaseActivity() {
return
}
Log.d(TAG, "File Uri: $uri")
val openInputStream = contentResolver.openInputStream(uri) ?: kotlin.run {
Toast.makeText(this, "解析失败", Toast.LENGTH_LONG).show()
return
}
try {
val openInputStream = contentResolver.openInputStream(uri) ?: kotlin.run {
Toast.makeText(this, "解析失败", Toast.LENGTH_LONG).show()
return
}
val inputAsString = openInputStream.bufferedReader().use { it.readText() }
val dataEntity = Gson().fromJson(inputAsString, DataEntity::class.java)
val classScheduleList = dataEntity.classScheduleList
Expand Down

0 comments on commit 48bc54d

Please sign in to comment.