Hi. I am a newbie and trying to decode a barcode image stored in res folder. I am using this code.
package com.example.barcodescan; import android.app.Activity; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import android.widget.TextView; import com.google.zxing.MonochromeBitmapSource; import com.google.zxing.MultiFormatReader; import com.google.zxing.qrcode.QRCodeReader; public class barcodescan extends Activity { /** Called when the activity is first created. */ private TextView tv; com.google.zxing.Result result; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); tv = (TextView) findViewById(R.id.text); Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.bar2); MultiFormatReader reader1 = new MultiFormatReader(); //for all barcode formats QRCodeReader reader = new QRCodeReader(); //only for QRCode format try { result = reader1.decode(new MonochromeBitmapSource(bitmap)); tv.setText(result.getText()); } catch(Exception e) { tv.setText("within catch block"); } } } but there is error when i uses MonochromeBitmapSource constructor. the error is "Cannot instantiate the type MonochromeBitmapSource". I dont know how to solve it. at few sites i found using YUVMonochromeBitmapSource but its not available in com.example.zxing. !! I am confused. plz help --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---