我的LogCat出现了一些错误......
E/Trace(627): error opening trace file: No such file or directory (2)
然后我无法找到解决方案帮助我。 PS。我试图将我的avd SD卡空间设置为256MB,但它的错误也是一样
-----------------我的LogCat -----------------
06-24 02:31:13.450: E / Trace(627): error opening trace file: No such file or directory (2)
06-24 02:31:14.290: D / libEGL(627): loaded /system/lib/egl/libEGL_emulation.so
06-24 02:31:14.300: D / (627): HostConnection::get() New Host Connection established 0x2a08fd48, tid 627
06-24 02:31:14.310: D / libEGL(627): loaded /system/lib/egl/libGLESv1_CM_emulation.so
06-24 02:31:14.320: D / libEGL(627): loaded /system/lib/egl/libGLESv2_emulation.so
06-24 02:31:14.390: W / EGL_emulation(627): eglSurfaceAttrib not implemented
06-24 02:31:14.400: D / OpenGLRenderer(627): Enabling debug mode 0
-----------------我的源代码-----------------
package com.nathaniel.web_list_20113212_nathaniel;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import android.app.Activity;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Color;
import android.os.Bundle;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.view.ViewManager;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
public class Web_List_Activity extends Activity implements OnClickListener {
DBManager dbmgr;
SQLiteDatabase sdb;
Cursor cur;
int list_count;
LinearLayout layout_weblist;
Button prev_btn;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.web_list);
layout_weblist = (LinearLayout)findViewById(R.id.weblist_area);
dbmgr = new DBManager(this);
sdb = dbmgr.getReadableDatabase();
cur = sdb.rawQuery("SELECT * FROM Websites", null);
list_count = cur.getCount();
if(list_count < 1) {
TextView tv = new TextView(this);
tv.setText("등록된 웹사이트가 존재하지 않습니다.");
tv.setGravity(Gravity.CENTER);
tv.setTextSize(20);
layout_weblist.addView(tv);
}
else if(list_count > 1) {
cur.moveToNext();
LinearLayout layout_webcontent = new LinearLayout(this);
layout_webcontent.setOrientation(LinearLayout.HORIZONTAL);
layout_webcontent.setBackgroundColor(Color.parseColor("#BBDEF8"));
/* <Column Line>
* wid integer
* wname text
* waddress text
* remark text
* hits integer */
String[] column = {String.valueOf(cur.getInt(0)), cur.getString(1), cur.getString(2), cur.getString(3), String.valueOf(cur.getInt(4))};
TextView[] tv_content = new TextView[5];
for(int i = 0; i < 5; i++) {
tv_content[i].setGravity(Gravity.CENTER);
tv_content[i].setText(column[i]);
layout_webcontent.addView(tv_content[i]);
layout_webcontent.setId(i);
layout_webcontent.setOnClickListener(this);
}
layout_weblist.addView(layout_webcontent);
}
}
@SuppressWarnings({ "deprecation", "null" })
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
LayoutInflater html_layer;
View html_view = null;
if(v.getId() != list_count) {
html_layer = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
html_view = html_layer.inflate(R.layout.web_html, null);
this.addContentView(html_view, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
cur.moveToPosition(v.getId());
String waddr = cur.getString(2); // address
TextView tv_html = (TextView)findViewById(R.id.htmlview);
URL url = null;
HttpURLConnection urlConnection = null;
BufferedInputStream buf = null;
try {
url = new URL(waddr);
urlConnection = (HttpURLConnection)url.openConnection();
buf = new BufferedInputStream(urlConnection.getInputStream());
BufferedReader bufreader = new BufferedReader(new InputStreamReader(buf, "utf-8"));
String line = null;
String page = "";
while((line = bufreader.readLine()) != null) {
page += line;
}
tv_html.setText(page);
}
catch(Exception e) {
Log.i("############", e.getMessage());
}
finally {
urlConnection.disconnect();
}
}
else
((ViewManager)html_view.getParent()).removeView(html_view);
}
}