0
我想开始一个活动,每次一个项目是点击一个ListView 我使用我的项目数据库,并使用全球varaibles在我的项目 但不能在项目 开始GalleryFileActivity活动如果您需要知道每个部分也将提供 感谢您不断努力,推进完善启动活动通过Listactivity
公共类DataListView扩展ListActivity {
final private ArrayList<String> results = new ArrayList<String>();
private String tableName = DBHelper.tableName;
private SQLiteDatabase newDB;
private String Path;
final private ArrayList<String> pikh = new ArrayList<String>();
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final global folder = ((global)getApplicationContext());
openAndQueryDatabase();
displayResultList();
}
private void displayResultList() {
TextView tView = new TextView(this);
tView.setText("data is");
getListView().addHeaderView(tView);
setListAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, results));
ListView lstView = getListView();
lstView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
lstView.setTextFilterEnabled(true);
}
public void onListItemClick(
ListView parent, View v, int position,long id, global folder)
{
String pos=results.get(position-1);
super.onListItemClick(parent, v, position, id);
Toast.makeText(this,
"You have selected " + results.get(position-1) ,
Toast.LENGTH_SHORT).show();
folder.setsubfolder (pos);
**startActivity(new Intent(this,GalleryFileActivity.class));**
}
public void onClick(View view) {
ListView lstView = getListView();
}
private void openAndQueryDatabase() {
try {
DBHelper dbHelper = new DBHelper(this.getApplicationContext());
newDB = dbHelper.getWritableDatabase();
Cursor c = newDB.rawQuery("SELECT Path, Header FROM resource1 "
, null);
if (c != null) {
if (c.moveToFirst()) {
do {
Path = c.getString(c.getColumnIndex("Path"));
String Header = c.getString(c.getColumnIndex("Header"));
results.add(Path + " " + Header);
}while (c.moveToNext()) ;
}
}
} catch (SQLiteException se) {
Log.e(getClass().getSimpleName(), "Could not create or Open the database");
} finally {
if (newDB != null)
newDB.execSQL("DELETE FROM " + tableName);
newDB.close();
}
}
}
我检查了所有的应用程序,并击中Vaio列表不打算活动 我怎么能通过ListActivity活动? –
你是否试图启动标准的手机照片库应用程序?或者,您的作品是GalleryFileActivity? –
是的,我确定问题是由listactivity Global转到活动,但我不确定它是否提供该功能 –