2017-01-25 4 views
0

論理的に間違っています。AndroidのJavaデータベースで新しいものです。エラーはありませんが、私の意見はあなたの意見です。他の列を使用して1つの列だけをデータ取り込みする方法

getSearch = searchbar.getText() .toString(); 
searchquery = "SELECT * FROM words WHERE tagalog LIKE '%"+ getSearch +"%';"; 
sqLiteDatabase.rawQuery(searchquery,null); 
Cursor c = wordsDBHelper.getdata(sqLiteDatabase); 
searchRes.setText(c.getString(2).toString()); 

任意の提案が受け入れられます。このボタンを押すと、このコードが位置し、ボタンはmainActivityに移動します。

heres the logcat 
    01-26 13:28:49.285 32177-32177/? D/dalvikvm: Late-enabling CheckJNI 
01-26 13:28:49.305 32177-32177/com.example.leoandroid.translate W/dalvikvm: VFY: unable to find class referenced in signature (Landroid/view/SearchEvent;) 
01-26 13:28:49.305 32177-32177/com.example.leoandroid.translate I/dalvikvm: Could not find method android.view.Window$Callback.onSearchRequested, referenced from method android.support.v7.view.WindowCallbackWrapper.onSearchRequested 
01-26 13:28:49.305 32177-32177/com.example.leoandroid.translate W/dalvikvm: VFY: unable to resolve interface method 17980: Landroid/view/Window$Callback;.onSearchRequested (Landroid/view/SearchEvent;)Z 
01-26 13:28:49.305 32177-32177/com.example.leoandroid.translate D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002 
01-26 13:28:49.305 32177-32177/com.example.leoandroid.translate I/dalvikvm: Could not find method android.view.Window$Callback.onWindowStartingActionMode, referenced from method android.support.v7.view.WindowCallbackWrapper.onWindowStartingActionMode 
01-26 13:28:49.305 32177-32177/com.example.leoandroid.translate W/dalvikvm: VFY: unable to resolve interface method 17984: Landroid/view/Window$Callback;.onWindowStartingActionMode (Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode; 
01-26 13:28:49.305 32177-32177/com.example.leoandroid.translate D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002 
01-26 13:28:49.315 32177-32177/com.example.leoandroid.translate D/dalvikvm: GC_FOR_ALLOC freed 125K, 27% free 2723K/3728K, paused 10ms, total 10ms 
01-26 13:28:49.315 32177-32177/com.example.leoandroid.translate I/dalvikvm-heap: Grow heap (frag case) to 7.125MB for 4651212-byte allocation 
01-26 13:28:49.325 32177-32183/com.example.leoandroid.translate D/dalvikvm: GC_FOR_ALLOC freed <1K, 13% free 7265K/8272K, paused 10ms, total 10ms 
01-26 13:28:49.355 32177-32177/com.example.leoandroid.translate I/dalvikvm: Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.widget.TintTypedArray.getChangingConfigurations 
01-26 13:28:49.355 32177-32177/com.example.leoandroid.translate W/dalvikvm: VFY: unable to resolve virtual method 433: Landroid/content/res/TypedArray;.getChangingConfigurations()I 
01-26 13:28:49.355 32177-32177/com.example.leoandroid.translate D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002 
01-26 13:28:49.355 32177-32177/com.example.leoandroid.translate I/dalvikvm: Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.widget.TintTypedArray.getType 
01-26 13:28:49.355 32177-32177/com.example.leoandroid.translate W/dalvikvm: VFY: unable to resolve virtual method 455: Landroid/content/res/TypedArray;.getType (I)I 
01-26 13:28:49.355 32177-32177/com.example.leoandroid.translate D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002 
01-26 13:28:49.435 32177-32177/com.example.leoandroid.translate I/PGA: Attempting to create new SOCKET connectionn pid = 32177, tid = 32177 
01-26 13:28:49.445 32177-32177/com.example.leoandroid.translate I/PGA: New SOCKET connection: com.example.leoandroid.translate (pid 32177, tid 32177) 

助けてください。私はそれを分析しようとしましたが、私は新しいソケット接続を作成しようとしました...それをMainactivityにリダイレクトしましたか?よくわかりません。

+0

自分のメインの活動次に

 public DataProvider getInformations() { SQLiteDatabase db = this.getReadableDatabase(); Cursor res = db.rawQuery("select "+your column+" from "+TABLE_NAME, null); res.moveToFirst(); DataProvider dataProvider = new DataProvider(); while(res.isAfterLast() == false) { dataProvider.setText(res.getString(res.getColumnIndex(Columnname))); res.moveToNext(); } db.close(); return dataProvider; } 

のようなあなたのDbHelperクラス内の関数を作成し、あなただけの1列が必要な場合、あなたは 'wordsから SELECTのようなSQLクエリを変更することができます...' –

+0

もう一つの列を追加して病気を残してください。私はちょうどボタンのこのコードに力を停止している –

+0

私のカーソルが正しいかどうか聞いている私は右です..それは正しいですか?私のカーソルシンタックスでは非常に疑わしいです。感謝の意を表してください。 –

答えて

2

機能との関係。

protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity); 

    userDbHelper =new UserDbHelper(this); 
    DataProvider dataProvider=userDbHelper.getInformations(); 
    text = dataProvider.getText(); 

    } 
+0

Pashどの社会的コミュニティにもあなたを追加できますか? Facebookのような。私はこれについて質問をしなければならない。例えば、与えられたコードでどうやって.getText().toString();エンドユーザの出力.. –

+0

ここに私のボタンコードPash .. 'btnSearch.setOnClickListener(new View.OnClickListener(){ @Override パブリックボイドonClick(ビューv){ /* PashはこれですMainActivity Codeあなたが言う?親切に助けてくださいtnx */ } }); ' –

+0

あなたの問題は解決しました..? – Pash

関連する問題