我正在创建一个应用程序,用于将学生数据从管理面板显示到教师面板。我创建了数据库类以在管理面板中插入数据:
package com.example.mytryapp;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
public class DatabaseHelper extends SQLiteOpenHelper {
private static final int DATABASE_VERSION = 1;
private static final String DATABASE_NAME = "teacher";
private static final String TABLE_NAME = "teacher_table";
private static final String NAME = "teacher_name";
private static final String FATHER_NAME = "father_name";
private static final String MOTHER_NAME = "mother_name";
private static final String ADDRESS = "address";
private static final String CONTACT = "contact";
private static final String E_MAIL = "e_mail";
private static final String SUBJECT = "subject";
private static final String EMP_ID = "emp_id";
SQLiteDatabase data=this.getWritableDatabase();
Context ctx;
public DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
ctx=context;
Log.d("DATABASE OPERATION", "DATABASE CREATED");
}
@Override
public void onCreate(SQLiteDatabase db) {
data=db;
db.execSQL("CREATE TABLE " + TABLE_NAME + " ("
//+ ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
+ NAME + " TEXT,"
+ FATHER_NAME + " TEXT,"
+ MOTHER_NAME + " TEXT,"
+ ADDRESS + " TEXT,"
+ CONTACT + " TEXT,"
+ E_MAIL + " TEXT,"
+ SUBJECT + " TEXT,"
+ EMP_ID + " TEXT"
+ ");");
Log.d("database operation", "table created");
}
public void open() throws SQLException
{
DatabaseHelper db1 = new DatabaseHelper(ctx);
data = db1.getWritableDatabase();
}
public void close()
{
data.close();
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXCEPTION EXISTS");
onCreate(db);
}
public void onInsert(DatabaseHelper db,String name,String f_name, String m_name,String address,String contact,String e_mail,String subject,String emp_id)
{
SQLiteDatabase sql= db.getWritableDatabase();
ContentValues cv=new ContentValues();
cv.put("teacher_name",name);
cv.put("father_name", f_name);
cv.put("mother_name", m_name);
cv.put("address", address);
cv.put("contact", contact);
cv.put("e_mail", e_mail);
cv.put("subject", subject);
cv.put("emp_id", emp_id);
sql.insert(TABLE_NAME, null, cv);
Log.d("DATABASE OPERATION", "ONE ROW INSERTED.....");
}
public Cursor getInformation(DatabaseHelper dop)
{
SQLiteDatabase SQ=dop.getReadableDatabase();
String[] coloumns={NAME,FATHER_NAME,MOTHER_NAME,ADDRESS,CONTACT,E_MAIL,SUBJECT,EMP_ID};
Cursor CR=SQ.query(TABLE_NAME, coloumns, null, null, null, null, null);
if (CR != null) {
CR.moveToFirst();
}
return CR;
}
}
和活动定义为:
package com.example.mytryapp;
import android.app.ActionBar;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class ManageStudent extends Activity{
EditText ROLLNO,STUD_NAME,FATHERNAME,MOTHERNAME,BRANCH,ADDR,CONTACT,EMAIL;
String rollno,stud_name,fathername,mothername,branch,addr,contact,email;
Button btn_save;
Context ctxx=this;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActionBar ab=getActionBar();
ab.setSubtitle("Be Here");
ab.setDisplayUseLogoEnabled(false);
ab.setDisplayHomeAsUpEnabled(true);
ab.setDisplayShowHomeEnabled(false);
setContentView(com.example.mytryapp.R.layout.manage_student);
ROLLNO=(EditText)findViewById(R.id.edit_rollno);
STUD_NAME=(EditText)findViewById(R.id.edit_stud_name);
FATHERNAME=(EditText)findViewById(R.id.edit_fathername);
MOTHERNAME=(EditText)findViewById(R.id.edit_mothername);
BRANCH=(EditText)findViewById(R.id.edit_branch);
ADDR=(EditText)findViewById(R.id.edit_stud_addrs);
CONTACT=(EditText)findViewById(R.id.edit_stud_contact);
EMAIL=(EditText)findViewById(R.id.edit_stud_email);
btn_save=(Button)findViewById(R.id.btn_stud_save);
btn_save.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
rollno=ROLLNO.getText().toString();
stud_name=STUD_NAME.getText().toString();
fathername=FATHERNAME.getText().toString();
mothername=MOTHERNAME.getText().toString();
branch=BRANCH.getText().toString();
addr=ADDR.getText().toString();
contact=CONTACT.getText().toString();
email=EMAIL.getText().toString();
DataHelperStudent DB=new DataHelperStudent(ctxx);
DB.open();
DB.onInsertStudent(DB, rollno, stud_name, fathername, mothername, branch, addr, contact, email);
Toast.makeText(getBaseContext(), "insertion sucessful", Toast.LENGTH_LONG).show();
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater1 = getMenuInflater();
inflater1.inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.logout:
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Do you want to logout ?")
.setCancelable(false)
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
Intent std_time=new Intent(ManageStudent.this,ChoosePanel.class);
startActivity(new Intent(ManageStudent.this,ChoosePanel.class));
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.setTitle("LOGOUT");
alert.show();
return true;
case android.R.id.home:
this.finish();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
}
并且此代码正常运行。
我为教师面板创建了另一个数据库类来显示学生的数据:
package com.example.mytryapp;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
public class DataHelperStudent extends SQLiteOpenHelper {
private static final int DATABASE_VERSION = 1;
private static final String DATABASE_NAME = "teacher";
//table
private static final String TABLE_NAME_STUDENT="student_table";
//private static final String ID="id";
private static final String ROLL_NO = "roll_no";
private static final String STUDENT_NAME = "student_name";
private static final String STUDENT_FATHER_NAME = "student_father_name";
private static final String STUDENT_MOTHER_NAME = "student_mother_name";
private static final String STUDENT_ADDRESS = "student_address";
private static final String STUDENT_CONTACT = "student_contact";
private static final String STUDENT_E_MAIL = "student_e_mail";
private static final String STUDENT_BRANCH_BATCH = "student_branch_batch";
SQLiteDatabase data=this.getWritableDatabase();
Context ctx;
public DataHelperStudent(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
ctx=context;
Log.d("DATABASE OPERATION", "DATABASE CREATED");
}
@Override
public void onCreate(SQLiteDatabase db) {
data=db;
db.execSQL("CREATE TABLE " + TABLE_NAME_STUDENT + " ("
//+ ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
+ ROLL_NO + " TEXT,"
+ STUDENT_NAME + " TEXT,"
+ STUDENT_FATHER_NAME + " TEXT,"
+ STUDENT_MOTHER_NAME + " TEXT,"
+ STUDENT_BRANCH_BATCH + " TEXT,"
+ STUDENT_ADDRESS + " TEXT,"
+ STUDENT_CONTACT + " TEXT,"
+ STUDENT_E_MAIL + " TEXT"
+ ");");
Log.d("database operation", "table created");
}
public void open() throws SQLException
{
DataHelperStudent db1 = new DataHelperStudent(ctx);
data = db1.getWritableDatabase();
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXCEPTION EXISTS");
onCreate(db);
}
public void onInsertStudent(DataHelperStudent db,String roll_no,String name, String f_name,String m_name,String branch,String address,String contact,String e_mail)
{
SQLiteDatabase sql= db.getWritableDatabase();
ContentValues cv=new ContentValues();
cv.put("roll_no",roll_no);
cv.put("student_name", name);
cv.put("student_father_name", f_name);
cv.put("student_mother_name", m_name);
cv.put("student_branch_batch", branch);
cv.put("student_address", address);
cv.put("student_contact", contact);
cv.put("student_e_mail", e_mail);
sql.insert(TABLE_NAME_STUDENT, null, cv);
Log.d("DATABASE OPERATION", "ONE ROW INSERTED.....");
}
public Cursor getInformation(DataHelperStudent dop)
{
SQLiteDatabase SQ=dop.getReadableDatabase();
String[] coloumns={ROLL_NO, STUDENT_NAME, STUDENT_FATHER_NAME, STUDENT_MOTHER_NAME, STUDENT_BRANCH_BATCH, STUDENT_ADDRESS, STUDENT_CONTACT, STUDENT_E_MAIL};
Cursor CR=SQ.query(TABLE_NAME_STUDENT, coloumns, null, null, null, null, null);
if (CR != null) {
CR.moveToFirst();
}
return CR;
}
public Cursor getRollNo(DataHelperStudent dop)
{
SQLiteDatabase sq=dop.getReadableDatabase();
String[] coloumns={ROLL_NO};
Cursor cr=sq.query(TABLE_NAME_STUDENT, coloumns, null, null,null,null,null);
if (cr != null) {
cr.moveToFirst();
}
return cr;
}
}
并且教师小组的两个活动是一个用于获取rollno
,另一个用于以这种方式显示该学生的数据:
package com.example.mytryapp;
import com.example.mytryapp.R;
import android.app.ActionBar;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
public class TeacherGetStudentDetail extends Activity{
SQLiteDatabase db;
EditText ROLLNO,NAME,FATHERNAME,MOTHERNAME,BRANCH,ADDRESS,CONTACT,EMAIL;
String rollno,name,fathername,mothername,branch,address,contact,email;
Button btn_save,btn_edit;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActionBar ab=getActionBar();
ab.setDisplayUseLogoEnabled(false);
ab.setDisplayHomeAsUpEnabled(true);
ab.setDisplayShowHomeEnabled(false);
setContentView(R.layout.teach_student);
ROLLNO=(EditText)findViewById(R.id.edit_stud_roll);
NAME=(EditText)findViewById(R.id.edit_student_name);
FATHERNAME=(EditText)findViewById(R.id.edit_stud_father);
MOTHERNAME=(EditText)findViewById(R.id.edit_stud_mother);
BRANCH=(EditText)findViewById(R.id.edit_stud_branch);
ADDRESS=(EditText)findViewById(R.id.edit_stud_addrs);
CONTACT=(EditText)findViewById(R.id.edit_stud_contact);
EMAIL=(EditText)findViewById(R.id.edit_stud_email);
DataHelperStudent DB= new DataHelperStudent(TeacherGetStudentDetail.this);
DB.open();
Cursor CR = DB.getInformation(DB);
if (CR.moveToFirst()) {
do {
int nameFieldColumnIndex = CR.getColumnIndex("roll_no");
rollno= CR.getString(nameFieldColumnIndex);
int nameFieldColumnIndex1 = CR.getColumnIndex("student_name");
name=CR.getString(nameFieldColumnIndex1);
int nameFieldColumnIndex2 = CR.getColumnIndex("student_father_name");
fathername= CR.getString(nameFieldColumnIndex2);
int nameFieldColumnIndex3 = CR.getColumnIndex("student_mother_name");
mothername= CR.getString(nameFieldColumnIndex3);
int nameFieldColumnIndex7 = CR.getColumnIndex("student_branch_batch");
branch= CR.getString(nameFieldColumnIndex7);
int nameFieldColumnIndex4 = CR.getColumnIndex("student_address");
address= CR.getString(nameFieldColumnIndex4);
int nameFieldColumnIndex5 = CR.getColumnIndex("student_contact");
contact= CR.getString(nameFieldColumnIndex5);
int nameFieldColumnIndex6 = CR.getColumnIndex("student_e_mail");
email= CR.getString(nameFieldColumnIndex6);
ROLLNO.setText(rollno);
NAME.setText(name);
FATHERNAME.setText(fathername);
MOTHERNAME.setText(mothername);
BRANCH.setText(branch);
ADDRESS.setText(address);
CONTACT.setText(contact);
EMAIL.setText(email);
} while (CR.moveToNext());
}
if (CR != null && !CR.isClosed()) {
CR.close();
}
if(DB!=null)
{
DB.close();
}
btn_save=(Button)findViewById(R.id.btn_save);
btn_save.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
rollno=ROLLNO.getText().toString();
name=NAME.getText().toString();
fathername=FATHERNAME.getText().toString();
mothername=MOTHERNAME.getText().toString();
branch=BRANCH.getText().toString();
address=ADDRESS.getText().toString();
contact=CONTACT.getText().toString();
email=EMAIL.getText().toString();
DataHelperStudent DB=new DataHelperStudent(TeacherGetStudentDetail.this);
DB.open();
DB.onInsertStudent(DB, rollno, name, fathername, mothername, branch, address, contact, email);
Toast.makeText(getBaseContext(), "insertion sucessful", Toast.LENGTH_LONG).show();
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater1 = getMenuInflater();
inflater1.inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.logout:
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Do you want to logout ?")
.setCancelable(false)
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
Intent std_time=new Intent(TeacherGetStudentDetail.this,ChoosePanel.class);
startActivity(new Intent(TeacherGetStudentDetail.this,ChoosePanel.class));
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.setTitle("LOGOUT");
alert.show();
return true;
case android.R.id.home:
this.finish();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
}
此代码在最后一天正常运行,但今天它显示此错误:
05-13 03:12:57.251: D/dalvikvm(933): GC_FOR_ALLOC freed 326K, 9% free 4629K/5072K, paused 72ms, total 86ms
05-13 03:12:57.421: D/DATABASE OPERATION(933): DATABASE CREATED
05-13 03:12:57.542: D/DATABASE OPERATION(933): DATABASE CREATED
05-13 03:12:57.542: E/SQLiteLog(933): (1) no such table: student_table
05-13 03:12:57.641: E/SQLiteDatabase(933): Error inserting roll_no=8 student_address=ldh student_father_name=hardesh student_name=monika student_mother_name=raj student_branch_batch=cse student_contact=26395426 student_e_mail=er.manju
05-13 03:12:57.641: E/SQLiteDatabase(933): android.database.sqlite.SQLiteException: no such table: student_table (code 1): , while compiling: INSERT INTO student_table(roll_no,student_address,student_father_name,student_name,student_mother_name,student_branch_batch,student_contact,student_e_mail) VALUES (?,?,?,?,?,?,?,?)
05-13 03:12:57.641: E/SQLiteDatabase(933): at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
05-13 03:12:57.641: E/SQLiteDatabase(933): at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:889)
05-13 03:12:57.641: E/SQLiteDatabase(933): at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:500)
05-13 03:12:57.641: E/SQLiteDatabase(933): at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
05-13 03:12:57.641: E/SQLiteDatabase(933): at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
05-13 03:12:57.641: E/SQLiteDatabase(933): at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:31)
05-13 03:12:57.641: E/SQLiteDatabase(933): at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1467)
05-13 03:12:57.641: E/SQLiteDatabase(933): at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1339)
05-13 03:12:57.641: E/SQLiteDatabase(933): at com.example.mytryapp.DataHelperStudent.onInsertStudent(DataHelperStudent.java:87)
05-13 03:12:57.641: E/SQLiteDatabase(933): at com.example.mytryapp.ManageStudent$1.onClick(ManageStudent.java:64)
05-13 03:12:57.641: E/SQLiteDatabase(933): at android.view.View.performClick(View.java:4240)
05-13 03:12:57.641: E/SQLiteDatabase(933): at android.view.View$PerformClick.run(View.java:17721)
05-13 03:12:57.641: E/SQLiteDatabase(933): at android.os.Handler.handleCallback(Handler.java:730)
05-13 03:12:57.641: E/SQLiteDatabase(933): at android.os.Handler.dispatchMessage(Handler.java:92)
05-13 03:12:57.641: E/SQLiteDatabase(933): at android.os.Looper.loop(Looper.java:137)
05-13 03:12:57.641: E/SQLiteDatabase(933): at android.app.ActivityThread.main(ActivityThread.java:5103)
05-13 03:12:57.641: E/SQLiteDatabase(933): at java.lang.reflect.Method.invokeNative(Native Method)
05-13 03:12:57.641: E/SQLiteDatabase(933): at java.lang.reflect.Method.invoke(Method.java:525)
05-13 03:12:57.641: E/SQLiteDatabase(933): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
05-13 03:12:57.641: E/SQLiteDatabase(933): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
05-13 03:12:57.641: E/SQLiteDatabase(933): at dalvik.system.NativeStart.main(Native Method)
05-13 03:12:57.641: D/DATABASE OPERATION(933): ONE ROW INSERTED.....
05-13 03:12:57.761: D/dalvikvm(933): GREF has increased to 201
05-13 03:13:11.651: I/Choreographer(933): Skipped 33 frames! The application may be doing too much work on its main thread.
05-13 03:13:14.521: I/Choreographer(933): Skipped 60 frames! The application may be doing too much work on its main thread.
05-13 03:13:16.054: I/Choreographer(933): Skipped 61 frames! The application may be doing too much work on its main thread.
05-13 03:13:17.681: I/Choreographer(933): Skipped 35 frames! The application may be doing too much work on its main thread.
05-13 03:13:20.891: I/Choreographer(933): Skipped 62 frames! The application may be doing too much work on its main thread.
05-13 03:13:29.811: I/Choreographer(933): Skipped 46 frames! The application may be doing too much work on its main thread.
05-13 03:13:33.151: I/Choreographer(933): Skipped 57 frames! The application may be doing too much work on its main thread.
05-13 03:13:37.311: D/DATABASE OPERATION(933): DATABASE CREATED
05-13 03:13:37.321: E/SQLiteLog(933): (1) no such table: student_table
05-13 03:13:37.331: D/AndroidRuntime(933): Shutting down VM
05-13 03:13:37.331: W/dalvikvm(933): threadid=1: thread exiting with uncaught exception (group=0x41465700)
05-13 03:13:37.531: E/AndroidRuntime(933): FATAL EXCEPTION: main
05-13 03:13:37.531: E/AndroidRuntime(933): android.database.sqlite.SQLiteException: no such table: student_table (code 1): , while compiling: SELECT roll_no FROM student_table
05-13 03:13:37.531: E/AndroidRuntime(933): at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
05-13 03:13:37.531: E/AndroidRuntime(933): at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:889)
05-13 03:13:37.531: E/AndroidRuntime(933): at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:500)
05-13 03:13:37.531: E/AndroidRuntime(933): at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
05-13 03:13:37.531: E/AndroidRuntime(933): at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
05-13 03:13:37.531: E/AndroidRuntime(933): at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:37)
05-13 03:13:37.531: E/AndroidRuntime(933): at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:44)
05-13 03:13:37.531: E/AndroidRuntime(933): at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1314)
05-13 03:13:37.531: E/AndroidRuntime(933): at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1161)
05-13 03:13:37.531: E/AndroidRuntime(933): at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1032)
05-13 03:13:37.531: E/AndroidRuntime(933): at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1200)
05-13 03:13:37.531: E/AndroidRuntime(933): at com.example.mytryapp.DataHelperStudent.getRollNo(DataHelperStudent.java:106)
05-13 03:13:37.531: E/AndroidRuntime(933): at com.example.mytryapp.TeacherStudent$1.onClick(TeacherStudent.java:49)
05-13 03:13:37.531: E/AndroidRuntime(933): at android.view.View.performClick(View.java:4240)
05-13 03:13:37.531: E/AndroidRuntime(933): at android.view.View$PerformClick.run(View.java:17721)
05-13 03:13:37.531: E/AndroidRuntime(933): at android.os.Handler.handleCallback(Handler.java:730)
05-13 03:13:37.531: E/AndroidRuntime(933): at android.os.Handler.dispatchMessage(Handler.java:92)
05-13 03:13:37.531: E/AndroidRuntime(933): at android.os.Looper.loop(Looper.java:137)
05-13 03:13:37.531: E/AndroidRuntime(933): at android.app.ActivityThread.main(ActivityThread.java:5103)
05-13 03:13:37.531: E/AndroidRuntime(933): at java.lang.reflect.Method.invokeNative(Native Method)
05-13 03:13:37.531: E/AndroidRuntime(933): at java.lang.reflect.Method.invoke(Method.java:525)
05-13 03:13:37.531: E/AndroidRuntime(933): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
05-13 03:13:37.531: E/AndroidRuntime(933): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
05-13 03:13:37.531: E/AndroidRuntime(933): at dalvik.system.NativeStart.main(Native Method)
05-13 03:13:37.681: D/dalvikvm(933): GC_FOR_ALLOC freed 263K, 8% free 5068K/5452K, paused 71ms, total 84ms
05-13 03:13:39.791: I/Process(933): Sending signal. PID: 933 SIG: 9
05-13 03:13:42.901: D/dalvikvm(994): GC_FOR_ALLOC freed 152K, 9% free 2849K/3120K, paused 46ms, total 50ms
05-13 03:13:43.091: D/dalvikvm(994): GC_FOR_ALLOC freed 111K, 10% free 3134K/3452K, paused 30ms, total 31ms
05-13 03:13:43.561: I/Choreographer(994): Skipped 31 frames! The application may be doing too much work on its main thread.
05-13 03:13:43.631: D/gralloc_goldfish(994): Emulator without GPU emulation detected.
请帮我解决这个问题......
答案 0 :(得分:0)
正如你所说,代码工作正常直到最后一天。您应该从设备卸载应用程序并再次运行它。在数据库的情况下,有时会发生这种类型的错误。