我已经尝试了三天,但我无法让我的程序从这个文件或任何其他文件中读取。请帮忙!我已经尝试创建另一个项目并放置它也不起作用。
TextView orangeTitle;
String line;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_gameplay);
// Show the Up button in the action bar.
setupActionBar();
try {
cardReader(null);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
setOrange();
}
public String cardReader(String args[]) throws IOException
{
FileInputStream fis = new FileInputStream("C:\\Users\\Alex\\Documents\\Android Development\\HumorMe\\assets\\orangecards.txt");
BufferedReader bfr = new BufferedReader(new InputStreamReader(fis));
line = bfr.readLine();
bfr.close();
return line;
}
public void setOrange()
{
orangeTitle = (TextView)findViewById(R.id.textView1);
orangeTitle.setText(line);
}