android软件文件定义,Android文件I / O openFileInput()未定义

在检查Android File I/O示例时,遇到一个问题:使用`openFileInput`时出现错误,提示该函数未定义。可能是由于缺少相关导入或存在其他编程错误。博主尝试加载文件并显示错误信息,寻求解决方案。
摘要由CSDN通过智能技术生成

package com.example.tictactoeshowgrid;

import android.os.Bundle;

import java.io.*;

import android.widget.Toast;

import android.content.*;

import java.io.FileInputStream;

import java.io.FileNotFoundException;

import java.io.FileOutputStream;

import java.io.IOException;

import java.util.Date;

import android.content.Context;

public class ImportOBJ {

protected void onCreate(String filename) {

try

{

FileInputStream fis = openFileInput(filename);

BufferedReader reader = new BufferedReader(new InputStreamReader(fis));

String line = null, input="";

while ((line = reader.readLine()) != null)

input += line;

reader.close();

fis.close();

//toast("File successfully loaded.");

//return input;

}

catch (Exception ex)

{

//toast("Error loading file: " + ex.getLocalizedMessage());

//return "";

}

}

}

我正在查看Android的File I / O示例.我想知道为什么openFileInput会出现一个错误,因为它是一个未定义的函数.我在想,也许我错过了一个导入?如果没有,则必然存在其他问题.

提前致谢…

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值