package my.honam.Datamanager;

import android.content.ContentProvider;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.UriMatcher;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.net.Uri;
import android.text.TextUtils;


public class ContentProviderTest extends ContentProvider {
    static final Uri CONTENT_URI = Uri.parse("content://my.honam.DataManager.DBTest/word");
    static final int ALLWORD =1;
    static final int ONEWORD=2;
 
    static final UriMatcher matcher;
    static{
       matcher = new UriMatcher(UriMatcher.NO_MATCH);
       matcher.addURI("my.honam.DataManager.DBTest", "word", ALLWORD);
       matcher.addURI("my.honam.DataManager.DBTest", "word/*", ONEWORD);
     }
   
    SQLiteDatabase db;
    @Override
    //도우미크래스
    public boolean onCreate() {
       DBHelper helper = new DBHelper(getContext());  
       db = helper.getWritableDatabase();
       return true;
    }
 
    @Override
    //MIME 타입을 정의
    public String getType(Uri uri) {
       if(matcher.match(uri)==ALLWORD){
           return "vnd.DBTest.Data.cursor.item/word";
       }
      if(matcher.match(uri)==ONEWORD){
          return "vnd.DBTest.Data.cursor.dir/words";
      }
      return null;
    }
 
   @Override
    public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
       String sql;
      //전체레코드 추출
      sql = "select * from student";
 
      //조건에 맞는 레코드 추출
      if(matcher.match(uri) == ONEWORD){
           sql += " where name = '" + uri.getPathSegments().get(1) + "'";
      }
      Cursor cursor = db.rawQuery(sql, null);
      return cursor;
    }
 
    @Override
    public Uri insert(Uri uri, ContentValues values) {
       long row = db.insert("student", null, values);
       if(row > 0){
          Uri notiuri = ContentUris.withAppendedId(CONTENT_URI, row);
          getContext().getContentResolver().notifyChange(notiuri, null);
          return notiuri;
      }
      return null;
    }

   

   @Override
    public int delete(Uri uri, String selection, String[] selectionArgs) {
       int count=0;
       switch(matcher.match(uri)){
          case ALLWORD:
              count = db.delete("student", selection, selectionArgs);
              break;
          case ONEWORD:
              String where;
              where = "name = '" + uri.getPathSegments().get(1) + "'";
              if(TextUtils.isEmpty(selection) == false){
                   where += " and" + selection;
              }
  
              count = db.delete("student", where, selectionArgs);
              break;
      }
      getContext().getContentResolver().notifyChange(uri, null);
      return count;
    }

 

   @Override
    public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
       int count = 0;
 
       switch (matcher.match(uri)) {
       case ALLWORD:
          count = db.update("student", values, selection, selectionArgs);
          break;
       case ONEWORD:
          String where;
          where = "name = '" + uri.getPathSegments().get(1) + "'";
          if(TextUtils.isEmpty(selection)==false){
              where += " AND " + selection;
          }
          count = db.update("student", values, where, selectionArgs);
          break;
      }
      getContext().getContentResolver().notifyChange(uri, null);
      return count;
    }

}


----------------------------------------------------------------------------------------------
여기서 위에쪽에 제가 빨간색글씨체와 밑줄로 에러표시를 해놨는데요 

 저것을 알아보니 ... 디비헬퍼에 대한 클래스가 없어서 생기는 오류라고 합니다

 그래서 제가 끼어넣기도해보고 알아보았는데 -_-;; 도통 어디다가 만들라는건지 알수가 없습니다;;

 이해가 되게끔 좀 알려주실분!!

 ㅠㅠ 맨날 여기다가 질문올리는것도 죄송스러워.. 하루내내혼자 해볼려고했지만

 도통 해결이 안되서 염치없이 글올립니다 ㅠㅠ