EditText의 ArrayLists (ArrayOne, ArrayTwo 및 ArrayThree)를 내부 저장소에 저장하려고합니다. 논평대로, 그것은 그것이 저장을 시도하는 것을 분명히 보여 주지만, 나는 그 후에 또 다른 TOAST를 얻지 못한다. "저장 완료"또는 오류가 표시되지 않는 이유에 대한 도움이 필요합니다. 당신이 일반 예외를 잡아 스택 트레이스를 인쇄 출력 할 수있는 단지 디버깅 목적 -Android 내부 개체 저장소
public void save(Context c)
{
String fileName;
Toast.makeText(this, "Attempting Save", Toast.LENGTH_SHORT).show();//THIS SHOWS
if(semester.getText().toString().length() == 0)
{
Toast.makeText(c, "Please enter a filename", Toast.LENGTH_SHORT).show();
}
else
{
fileName = "test.dat";
FileOutputStream fos = null;
ObjectOutputStream oos = null;
try
{
fos = this.openFileOutput(fileName, Context.MODE_PRIVATE);
oos = new ObjectOutputStream(fos);
oos.writeObject(ArrayOne);
oos.writeObject(ArrayTwo);
oos.writeObject(ArrayThree);
Toast.makeText(c, "Save Completed", Toast.LENGTH_SHORT).show(); //THIS NEVER SHOWS
}
catch (FileNotFoundException e)
{
Toast.makeText(c, "Could not find " + fileName + " to save.", Toast.LENGTH_SHORT).show();
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
finally
{
try
{
if (oos != null)
oos.close();
if (fos != null)
fos.close();
}
catch (Exception e)
{ /* do nothing */ }
}
}
}
안녕하세요 당신은 디버깅을 시도 했습니까? "찾을 수 없음"을 표시합니까 ?? – PedroAGSantos
디버깅을 시도했지만 "저장 시도 중"이 아무것도 표시되지 않습니다. 코드가 어디서 나왔는지 모르겠습니다. – Andrew
디버깅을 시도하십시오. 디버그하면 다른 사람의 도움없이이 문제를 해결할 수 있습니다. 그냥 코드가 어디로가는 추적하고 :) 완료 –