强文本
我无法打开数据库并对其进行查询。我想访问使用意图值从不同的 java 文件传递的表行。请帮忙 !
import java.io.File;
import java.util.ArrayList;
import android.app.Activity;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.widget.ListView;
import android.widget.Toast;
public class Finish_kitchen extends Activity {
GridView gridView;
private imageAdapter imageAdapter;
private SQLiteDatabase db;
private static String DB_Path = "/mnt/sdcard/Kitchen_Data.db";
private Cursor c;
private String path;
private ListView listView1;
private ArrayList<String> Steps;
private ArrayList<String> Image_path;
private ArrayList<String> Audio_path;
private int count;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.finish_kit);
listView1 = (ListView) findViewById(R.id.listView1);
Steps = new ArrayList<String>();
Image_path = new ArrayList<String>();
Audio_path = new ArrayList<String>();
path = getIntent().getStringExtra("path");
db = SQLiteDatabase.openDatabase(DB_Path, null, SQLiteDatabase.OPEN_READWRITE);
c = db.query(path, null, null, null, null, null, null);
c.moveToFirst();
Steps.add(c.getString(1));
Toast.makeText(getApplicationContext(), "heyaa gotcha", Toast.LENGTH_LONG).show();
}
}
日志猫
performCreate(Activity.java:5117) 04-04 11:52:12.400: E/AndroidRuntime(26824): 在 android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1081) 04-04 11:52:12.400: E/ AndroidRuntime(26824): 在 android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2150) 04-04 11:52:12.400: E/AndroidRuntime(26824): ... 11 更多 04-04 11:52:14.922: I/Process(26824):发送信号。PID:26824 SIG:9