I keep getting this "Table has no column named" error, I saw few solutions here, but none of them helped me. I did see that I should go to settings/apps and clear data but I couldnt find it on setting, so I hope I'll find answer here.
package com.bengu.bvb;
import android.content.ContentValues;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import static com.bengu.bvb.TableData.*;
public class DataBaseOperation extends SQLiteOpenHelper {
public static final int database_version=1;
public String CREATE_QUERY="CREATE TABLE "+ TableInfo.TABLE_NAME+"("+TableInfo.PLAYER_NAME+" TEXT,"+ TableInfo.PLAYER_Family+" TEXT);";
public DataBaseOperation(Context context) {
super(context, TableInfo.DATABASE_NAME, null, database_version);
Log.d("Database operations","Database created");
}
@Override
public void onCreate(SQLiteDatabase sdb) {
sdb.execSQL(CREATE_QUERY);
Log.d("Database operations", "Table created");
}
@Override
public void onUpgrade(SQLiteDatabase arg0, int arg1, int arg2) {
}
public void putInformation(DataBaseOperation dop,String name,String family)
{
SQLiteDatabase SQ =dop.getWritableDatabase();
ContentValues cv=new ContentValues();
cv.put(TableInfo.PLAYER_Family, family);
long k= SQ.insert(TableInfo.TABLE_NAME, null,cv);
Log.d("Database operations", "One raw inserted");
}
package com.bengu.bvb;
public class TableData {
public TableData()
{
}
public static abstract class TableInfo implements BaseColumns
{
public static final String PLAYER_NAME="player_name";
public static final String PLAYER_Family="last_name";
public static final String DATABASE_NAME="player_info";
public static final String TABLE_NAME="reg_info";
}
now I dont get this error i get another error.
java.lang.SecurityException: Permission Denial: get/set setting for user asks to run as user -2 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL
at com.android.server.am.ActivityManagerService.handleIncomingUser(ActivityManagerService.java:14673)
at android.app.ActivityManager.handleIncomingUser(ActivityManager.java:2473)
at com.android.providers.settings.SettingsProvider.call(SettingsProvider.java:688)
at android.content.ContentProvider$Transport.call(ContentProvider.java:325)
at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:275)
at android.os.Binder.execTransact(Binder.java:404)
at dalvik.system.NativeStart.run(Native Method)
and that is my manifest file:
<?xml version="1.0" encoding="utf-8"?>
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="22" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission
android:name="android.permission.READ_PHONE_STATE" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Main2Activity"
android:label="@string/title_activity_main2" >
</activity>
<activity
android:name=".Menu"
android:label="@string/title_activity_menu" >
</activity>
<activity
android:name=".MainApp"
android:label="@string/title_activity_main_app" >
</activity>
<activity
android:name=".AddScreen"
android:label="@string/title_activity_add_screen" >
</activity>
</application>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…