-3
我一直在關注本教程在YouTube上關於錯誤:無法找到符號類CopyDbActivity
「如何包含在Android應用SQLite數據庫」
這裏是鏈接
https://www.youtube.com/watch?v=iE_bsPfB00w&t=2s
這是我的MainActivity的代碼
import java.io.IOException;
import android.database.Cursor;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.database.SQLException;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
Cursor c = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
((Button) findViewById(R.id.button)).setOnClickListener(new
View.OnClickListener(){
@Override
public void onClick(View v){
DatabaseHelper myDbHelper = new
DatabaseHelper(CopyDbActivity.this);
try{
myDbHelper.createDataBase();
}catch (IOException ioe){
throw new Error("Unable to create database");
}
try{
myDbHelper.openDataBase();
}catch (SQLException sqle){
throw sqle;
}
Toast.makeText(CopyDbActivity.this,"Success",Toast.LENGTH_SHORT).show();
c= myDbHelper.query("penyakit_TABLE",null,null,null,null,null,null);
if(c.moveToFirst()){
do{
Toast.makeText(CopyDbActivity.this,"simptom"+c.getString(1),Toast.LENGTH_LONG).show();
}while(c.moveToNext());
}
}
});
}
}
我得到了這些錯誤。如何解決這個問題?
Error:(25, 64) error: cannot find symbol class CopyDbActivity
Error:(36, 32) error: cannot find symbol class CopyDbActivity
Error:(40, 40) error: cannot find symbol class CopyDbActivity