android studio读写文件路径,阅读文件路径android studio

嗨im仍然是新手在android编程。我想知道如何在android代码中读取像“/home/emulator/0/blabla/file.txt/”这样的文件路径。我需要知道如何读取文件路径,因为我必须从应用程序访问android上的特定文件。并且路径已经在代码中定义了,所以用户只会得到读数的输出。阅读文件路径android studio

public void naivebayes() throws Exception {

//im using weka to read a .arff file

//the problem is i didnt know how to "write" the path, from where i should start it

//p.s: i already tried open the files on my phone then clikc "Details" to see the path on the phone and write it on the code but the code still could'nt read the files

DataSource source = new DataSource("File Path");

Instances dataset = source.getDataSet();

//set class index to the last Attributes

dataset.setClassIndex(dataset.numAttributes()-1);

//create and build the classifier

NaiveBayes nb = new NaiveBayes();

nb.buildClassifier(dataset);

tv.setText(nb.getCapabilities().toString());

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值