方法中的getBitMap(Bitmap)类型不适用于参数(byte [])? [英] Method getBitMap(Bitmap) in the type is not applicable for argument (byte[])?

查看:86
本文介绍了方法中的getBitMap(Bitmap)类型不适用于参数(byte [])?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在某些方面遇到了错误,我不知道如何修复它。

问题是我在循环中出错了一些错误



类型中的方法getBitMap(位图)不适用于参数(byte [])



I got error in some part, i don't know how to fix it.
The problem is i got error some error in looping

"Method getBitMap(Bitmap) in the type is not applicable for argument (byte[])"

if (cursor.moveToFirst()) {
            do {
                Question quest = new Question();
                quest.setID(cursor.getInt(0));
                quest.getBitmap(cursor.getBlob(1)); //error is here
                quest.setQUESTION(cursor.getString(2));
                quest.setANSWER(cursor.getString(3));
                quest.setOPTA(cursor.getString(4));
                quest.setOPTB(cursor.getString(5));
                quest.setOPTC(cursor.getString(6));
                quesList.add(quest);
            } while (cursor.moveToNext());
        }
        // return quest list
        return quesList;







Question.java





Question.java

package com.JAFNS.pediakids;

import android.graphics.Bitmap;


public class Question {
	
		private int ID;
		private Bitmap bmp;
		private String QUESTION;
		private String OPTA;
		private String OPTB;
		private String OPTC;
		private String ANSWER;
		public Question()
		{
			ID=0;
			QUESTION="";
			OPTA="";
			OPTB="";
			OPTC="";
			ANSWER="";
		}
		public Question(Bitmap b, String qUESTION, String oPTA, String oPTB, String oPTC,
				String aNSWER) {
			
			bmp = b;
			QUESTION = qUESTION;
			OPTA = oPTA;
			OPTB = oPTB;
			OPTC = oPTC;
			ANSWER = aNSWER;
		}
		public int getID()
		{
			return ID;
		}
		public Bitmap getBitmap(){
			return bmp;
		}
		public String getQUESTION() {
			return QUESTION;
		}
		public String getOPTA() {
			return OPTA;
		}
		public String getOPTB() {
			return OPTB;
		}
		public String getOPTC() {
			return OPTC;
		}
		public String getANSWER() {
			return ANSWER;
		}
		public void setID(int id)
		{
			ID=id;
		}
		public void setQUESTION(String qUESTION) {
			QUESTION = qUESTION;
		}
		public void setOPTA(String oPTA) {
			OPTA = oPTA;
		}
		public void setOPTB(String oPTB) {
			OPTB = oPTB;
		}
		public void setOPTC(String oPTC) {
			OPTC = oPTC;
		}
		public void setANSWER(String aNSWER) {
			ANSWER = aNSWER;
		}
		public void getBitmap(Bitmap b) {
			// TODO Auto-generated method stub
			this.bmp = b;
		}
		
	}

推荐答案

你试图用错误的类型调用方法论点。 cursor.getBlob(1)返回 byte [] (字节数组)而不是位图。
You are trying to call the method with the wrong type of argument. cursor.getBlob(1) returns a byte[] (array of bytes) not a bitmap.


这篇关于方法中的getBitMap(Bitmap)类型不适用于参数(byte [])?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆