如何将Firebase中的文本文件读取到Android应用程序

我正在开发基于内容的Android应用程序。我使用Firebase上传所有文本文件(在rtf或doc文件中)。当我将一个文本文件上传到Firebase后,我创建了一个详细的活动,从firebase下载文件,但文本文件不读,它什么也没有显示。这里是我的Kotlin代码…

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) } } } 

我已经得到了答案! 为了使用文本文件,我不必将其加载到Firebase存储中。而是直接以Json格式上传到Firebase数据库。