2016-11-24 6 views

答えて

0
public Bitmap getCurrentBitmap() { 
     SQLiteDatabase db  = dbs.getWritableDatabase(); 
     String sql    = "SELECT * FROM Image";// SELECT blob image column. 
     Cursor cursor   = db.rawQuery(sql, new String[]{}); 
     Bitmap bmp=null; 
     if(cursor.moveToFirst()){ 
      //this.accId    = cursor.getInt(0); 
      // this.accName   = cursor.getString(1); 
      byte[] logoImage  = cursor.getBlob(1);// get blob image convert into byte array[] 

     Bitmap bmp = BitmapFactory.decodeByteArray(logoImage, 0, logoImage.length);// now convert into Bitmap 
     } 
     if (cursor != null && !cursor.isClosed()) { 
      cursor.close(); 
     } 
     db.close(); 
     if(cursor.getCount() == 0){ 
      return null; 
     } else { 
      return bmp; 
     } 
    } 

//はなぜURLが存在することになる画像

profile_images.setImageBitmap(getCurrentBitmap()); 
+0

しかし、私のデータベースはWAMPサーバです。私はアンドロイドには新しく、ちょうどそれを学びます。だからそれに応じてコードを編集してください。 –

0

を表示するには?データベースからコンテンツを取得するためのURLはありません。コンテンツを入れるURLはありません。スクリプトを実行するためのURLだけがあります。あなたは、あなたがそのURLを知っているだろうコンテンツを取得するスクリプトを持っていた場合

は、まあ、私は考えて

関連する問題