خرید بک لینک

Vote count: 0

i want to convert a drawable from an object to a bitmap, but when i try to use this

    Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), 
    cardWriter.getCardImage());

it gives me an error wrong second argument expecting 'drawable' found 'int' but this is definitely a drawable. When i begin to write cardWriter.getCardImage() android studios code completion says its a drawable, this is from my CardWriters class

  public CardWriter(Drawable cardImage, String cardEmotion, String 
  speechText)
{
    this.cardImage = cardImage;
    this.cardEmotion = cardEmotion;
    this.speechText = speechText;

} 

i think it may be my context thats wrong but i dont see how as its just a method that i pass the context too, heres the full thing

 public void insertCardDetails(Context context, CardWriter cardWriter) {
    ContentValues cv = new ContentValues();
    Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), cardWriter.getCardImage());
    cv.put(CARD_PHOTO, Utility.getBytes(bitmap));
    cv.put(CARD_NAME, cardWriter.getCardEmotion());
    cv.put(CARD_SPEECH, cardWriter.getSpeechText());
    IconsDB.insert(EMPLOYEES_TABLE, null, cv);
}

what am i not doing?

asked 36 secs ago

برچسب: نویسنده: استخدام کار تاريخ: شنبه 29 خرداد 1395 ساعت: 5:49

صفحه بندی