我正在为一个学校项目开发一个基本的 android 应用程序。一切正常,直到我放入一个充当我的文件对象的新类 - 我写入它的变量,然后将对象保存到 SD 卡。但是我现在得到一个调试错误。它不包含对我自己的代码的任何引用——它似乎是指在它启动活动时发生的事情,而不是在它执行我的代码时发生的事情。有什么建议么?调试控制台中的错误消息如下:
Homework Planner [Android Application]
DalvikVM[localhost:8600]
Thread [<1> main] (Suspended (exception RuntimeException))
<VM does not provide monitor information>
ActivityThread.performLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 2194
ActivityThread.handleLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 2229
ActivityThread.access$600(ActivityThread, ActivityThread$ActivityClientRecord, Intent) line: 139
ActivityThread$H.handleMessage(Message) line: 1261
ActivityThread$H(Handler).dispatchMessage(Message) line: 99
Looper.loop() line: 154
ActivityThread.main(String[]) line: 4945
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 511
ZygoteInit$MethodAndArgsCaller.run() line: 784
ZygoteInit.main(String[]) line: 551
NativeStart.main(String[]) line: not available [native method]
Thread [<10> Binder Thread #2] (Running)
Thread [<9> Binder Thread #1] (Running)
Daemon Thread [<8> FinalizerWatchdogDaemon] (Running)
Daemon Thread [<7> FinalizerDaemon] (Running)
Daemon Thread [<6> ReferenceQueueDaemon] (Running)
这是活动开始的代码:
public class InputActivity extends Activity {
String chosenSubject = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_input);
// Set up the spinner and it's listener
Spinner subjectSpinner = (Spinner) findViewById(R.id.deadlinePicker);
subjectSpinner.setOnItemSelectedListener(new OnItemSelectedListener() {
public void onNothingSelected(AdapterView<?> arg0) {}
public void onItemSelected(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
chosenSubject = (String) arg0.getItemAtPosition(arg2);
}
});
// Set up save button
Button saveButton = (Button) findViewById(R.id.btnSave);
saveButton.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
//saveFile();
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_input, menu);
return true;
}