Reading from a Text file in Android Studio Java | 合法醫療器材資訊網
2018年8月22日—Sinceyou'reusingandroidstudioyoucaneithercreateamain(String[]args)...}methodandrunitorjuststarttheemulatorandhaveit ...
You should have a MainActivity.java or some Activity which instantiates QuoteBank. You would want the constructor to take in a parameter of context:
Setup a private variable in QuoteBank.java:
private Context mContext;Setup up the constructor:
public QuoteBank(Context context) { this.mContext = context; }Then instantiate it in your activity,
QuoteBank quoteBank = new QuoteBank(context);The context variable can be called within an activity by the this command or Activity.this where you replace "Activity" with your activity name. Alternatively if you are within a fragment, you can get the context from the View object inside your onCreateView(...) method. Usually by calling view.getContext().
Now in your method where you are grabbing the assets, you can use the context:
InputStream is = mContext.getAssets().open("QuotesMonkeyBusin...File | 合法醫療器材資訊網
How to make a txt file and read txt file from internal storage in ... | 合法醫療器材資訊網
How to read a simple text file in Android App? | 合法醫療器材資訊網
Reading from a Text file in Android Studio Java | 合法醫療器材資訊網
ReadWrite String fromto a File in Android | 合法醫療器材資訊網
[程式] Android Studio | 合法醫療器材資訊網
【放射性同位素診斷設備】許可證字號:衛署醫器輸字第000236號
器材品名:放射性同位素診斷設備許可證字號:衛署醫器輸字第000236號註銷狀態:已註銷註銷日期:1985/09/26註銷理由:未展延而逾...