我正在尝试在清单中声明我的内容提供程序类,但是当我键入提供程序类的完全限定名称的名称时,它会显示错误:
错误是期望的类或接口,这是什么意思?
错误发生在这一行:android:name =“com.sns.awesomecharactercreator.CharacterProvider”有一条红线下面,当我将鼠标悬停在它上面时,表示类或接口是预期的
以下是代码:
<?xml version="1.0" encoding="utf-8"?>
<!--suppress ALL -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sns.awesomecharactercreator" >
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".Welcome"
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=".EditingCharacter"
android:label="@string/title_activity_general_characteristics"
android:parentActivityName=".Notes" >
</activity>
<provider
android:authorities="com.sns.awesomecharactercreator.characterprovider"
android:name="com.sns.awesomecharactercreator.CharacterProvider"
android:exported="false" />
</application>
CharacterProvider类:
package com.sns.awesomecharactercreator;
import android.content.ContentValues;
import android.content.UriMatcher;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.net.Uri;
import DATALAYER.DBHelper;
public class CharacterProvider extends android.content.ContentProvider {
private final static String AUTHORITY = "com.sns.awesomecharactercreator.characterprovider";
private final static String BASE_PATH = "characterattributes";
public final static Uri CONTENT_URI =
Uri.parse("content://" + AUTHORITY + "/" + BASE_PATH);
private static final int CHARACTERS = 1;
private static final int CHARACTERS_ID = 2;
private static final UriMatcher uriMatcher =
new UriMatcher(UriMatcher.NO_MATCH);
static {
uriMatcher.addURI(AUTHORITY, BASE_PATH, CHARACTERS);
uriMatcher.addURI(AUTHORITY, BASE_PATH + "/#", CHARACTERS_ID);
}
private static final String[] allColumns = {
DBHelper.CHARACTERATTRIBUTES_ID,
DBHelper.CHARACTERATTRIBUTES_NAME,
DBHelper.CHARACTERATTRIBUTES_MEANING,
DBHelper.CHARACTERATTRIBUTES_NICKNAME,
DBHelper.CHARACTERATTRIBUTES_RELIGION,
DBHelper.CHARACTERATTRIBUTES_BIRTHDATE,
DBHelper.CHARACTERATTRIBUTES_BIRTHPLACE,
DBHelper.CHARACTERATTRIBUTES_SIGN,
DBHelper.CHARACTERATTRIBUTES_TALENTS,
DBHelper.CHARACTERATTRIBUTES_MAINSEC,
DBHelper.CHARACTERATTRIBUTES_WEAPONS,
DBHelper.CHARACTERATTRIBUTES_CLASSS,
DBHelper.CHARACTERATTRIBUTES_STRENGTHS,
DBHelper.CHARACTERATTRIBUTES_WEAKNESSES,
DBHelper.CHARACTERATTRIBUTES_ROLE,
DBHelper.CHARACTERATTRIBUTES_VOICE,
DBHelper.CHARACTERATTRIBUTES_SECRETS,
DBHelper.CHARACTERATTRIBUTES_PROFESSION,
DBHelper.CHARACTERATTRIBUTES_QUOTE,
DBHelper.CHARACTERATTRIBUTES_AGE,
DBHelper.CHARACTERATTRIBUTES_BODYTYPE,
DBHelper.CHARACTERATTRIBUTES_HEIGHT,
DBHelper.CHARACTERATTRIBUTES_WEIGHT,
DBHelper.CHARACTERATTRIBUTES_FACESHAPE,
DBHelper.CHARACTERATTRIBUTES_EYECOLOR,
DBHelper.CHARACTERATTRIBUTES_HAIRCOLOR,
DBHelper.CHARACTERATTRIBUTES_HAIRSTYLE,
DBHelper.CHARACTERATTRIBUTES_SPECIALFEATURES,
DBHelper.CHARACTERATTRIBUTES_HEALTH,
DBHelper.CHARACTERATTRIBUTES_DISABILITIES,
DBHelper.CHARACTERATTRIBUTES_SKINTONE,
DBHelper.CHARACTERATTRIBUTES_ACCESORIES,
DBHelper.CHARACTERATTRIBUTES_CLOTHES,
DBHelper.CHARACTERATTRIBUTES_ALOOKALIKE,
DBHelper.CHARACTERATTRIBUTES_ETHNICITY,
DBHelper.CHARACTERATTRIBUTES_IQLEVEL,
DBHelper.CHARACTERATTRIBUTES_EDUCATION,
DBHelper.CHARACTERATTRIBUTES_DOMINANTMOOD,
DBHelper.CHARACTERATTRIBUTES_MORALCODES,
DBHelper.CHARACTERATTRIBUTES_DESIRES,
DBHelper.CHARACTERATTRIBUTES_DISLIKES,
DBHelper.CHARACTERATTRIBUTES_ATTITUDES,
DBHelper.CHARACTERATTRIBUTES_EMOTIONHANDLING,
DBHelper.CHARACTERATTRIBUTES_QUALITIES,
DBHelper.CHARACTERATTRIBUTES_FLAWS,
DBHelper.CHARACTERATTRIBUTES_GOALS,
DBHelper.CHARACTERATTRIBUTES_POPULARITY,
DBHelper.CHARACTERATTRIBUTES_REPUTATION,
DBHelper.CHARACTERATTRIBUTES_CHARISMA,
DBHelper.CHARACTERATTRIBUTES_RELATIVES,
DBHelper.CHARACTERATTRIBUTES_COMPANIONS,
DBHelper.CHARACTERATTRIBUTES_LOVELIFE,
DBHelper.CHARACTERATTRIBUTES_NOTES};
private SQLiteDatabase db;
@Override
public boolean onCreate() {
DBHelper helper = new DBHelper(getContext());
db = helper.getWritableDatabase();
return true;
}
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
return db.query(DBHelper.TABLE_CHARACTERATTRIBUTES, allColumns, selection, null, null, null, null);
}
@Override
public String getType(Uri uri) {
return null;
}
@Override
public Uri insert(Uri uri, ContentValues values) {
long id = db.insert(DBHelper.TABLE_CHARACTERATTRIBUTES, null, values);
return Uri.parse(BASE_PATH + "/#" + id);
}
@Override
public int delete(Uri uri, String selection, String[] selectionArgs) {
return db.delete(DBHelper.TABLE_CHARACTERATTRIBUTES, selection, selectionArgs);
}
@Override`enter code here`
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
return db.update(DBHelper.TABLE_CHARACTERATTRIBUTES,values,selection,selectionArgs);
}
}
有人可以成为亲爱的并帮助我吗?我被永远地困住了,我差点把头发撕掉。