我有一个问题,
我有一个在Android中扩展BroadcastReceiver的类。在那个类中,我想以追加模式打开一个文件但是如果我这样做
OutputStreamWriter osw = new OutputStreamWriter(context.getApplicationContext().openFileInput(file));
Eclipse,说“Context中的方法openFileInput(String)不适用于参数(String,int)”
任何人都知道我该怎么做?
编辑:我正在添加更多代码,以便更好地查看问题
public class ServicioLlamada extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Call c = new Call(Integer.valueOf(number), date, length, TYPE_CALL);
saveFile(c,context);
}
private void saveFile(Llamadas l, Context context) {
String file = "callList.bin";
OutputStreamWriter osw = new OutputStreamWriter(context.getApplicationContext().openFileInput(file,Activity.MODE_APPEND));
file.write(l);
file.flush();
file.close();
}