0
私はFirebaseを使用して、すべてのテキストファイル(rtfまたはdocファイル)をアップロードしました。Firebaseに1つのテキストファイルをアップロードした後、 firebaseからファイルをダウンロードしますが、テキストファイルが読み込まれていない詳細な活動が、それは私が答えを持っているFirebaseからAndroid Appへのテキストファイルの読み込み方法
class detailOne : AppCompatActivity() {
private var mTextView : TextView? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.detailone)
val myButton = findViewById(R.id.butOne) as Button
mTextView = findViewById(R.id.myText) as TextView
FirebaseApp.initializeApp(this)
val storage = FirebaseStorage.getInstance()
val storageRef = storage.getReferenceFromUrl("gs://yehwot-eta.appspot.com/story.rtf")
try {
val localFile = File.createTempFile("text", "rtf")
storageRef.getFile(localFile).addOnSuccessListener {
}.addOnFailureListener {
print("Connection is Lost!Please Try Again")
}
}
} catch(e : IOException) {
e.printStackTrace()
}
myButton.setOnClickListener {
val myIntent = Intent()
myIntent.action = Intent.ACTION_SEND
myIntent.type = "text/plain"
myIntent.putExtra(Intent.EXTRA_TEXT,"This is my Text")
startActivity(myIntent)
}
}
}