无法读取文件。 我发现使用调试后调试是str = parser.nextText();这一步例外。我问我的xml文件格式有什么问题吗?
package com.example.sqltest;
import java.util.List;
import java.util.Random;
import com.example.sqltest.dao.person;
import com.example.sqltest.dao.personDao2;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends Activity {
private TextView tv ;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.linerayoutmain);
personDao2 pd = new personDao2(this);
long number = 10000 ;
Random random = new Random();
for (int i = 0 ; i <50;i++){
pd.add("wengwenewn"+i, Long.toString(number+random.nextInt(5000)));
}
List<person> persons = pd.findall();
}
}
这是我的the weather.xml
<?xml version="1.0" encoding="utf-8"?>
<info>
<city>"china"</city>
</info>
weather.xml附近的D:\ eclipse workspce \ testReadXML \ src \ weather.xml
我的logcat显示为:。
03-16 09:56:32.521: E/memtrack(1867): Couldn't load memtrack module (No such file or directory)
03-16 09:56:32.521: E/android.os.Debug(1867): failed to load memtrack module: -2
03-16 09:56:33.121: E/memtrack(1877): Couldn't load memtrack module (No such file or directory)
03-16 09:56:33.121: E/android.os.Debug(1877): failed to load memtrack module: -2