Click here to Skip to main content
15,885,720 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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[])"

C#
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

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;
		}
		
	}
Posted

1 solution

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.
 
Share this answer
 
Comments
JaironLanda 1-May-15 5:47am    
Then how to fix it? any idea?
Richard MacCutchan 1-May-15 5:51am    
You need to use some method to convert the blob to a bitmap.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900