[android-beginners] Re: Reading/Decoding bar code stored in resources
Wahib, I will try out a few things and let you know. I spend 2 days in a week on this one that is why there is delay in my replies..Sorry for that. Is it possible for you to send your code to try a few things with it? I will keep you posted. Thanks, Abhishek On Oct 14, 7:38 pm, wahib haq wahib.t...@gmail.com wrote: feels good to see your reply. Its just an assignment for me. yes i am stuck with part 1. In the start i tried a lot with camera stuff and searched for source codes to display camera preview and take snap. I was successful with getting camera preview but either the image was not saved or the image taken was of very small size like thumbnail. so then i thought about using the built-in camera app. Then after few days of research i able to call the camera app as i click a button in my custom app. but now the issue is after taking snap i want to run my decode function.But i dont know how to exit the camera preview and call my decode() function:S so its here i am stuck with. I have posted it and i'll post it again. it wud be great if you could help me. Regards, wahib On 10/14/09,Abhishekabhishek.moh...@gmail.com wrote: Wahib.. sorry for the mistake in your name. Thanks for pointing out. 3 phases of my app 1) Scan picture(bar code) from camera store 2) Decode the barcode 3.) Search the product information and display. I am done with Part 2.. I think you are also working on same application if I am not wrong. Now I will concentrate on Part 1. Where are you stuck in Part1? What is the error if any? Please let me know. I will also keep you posted. Thanks, Abhishek On Oct 9, 10:36 pm, wahib haq wahib.t...@gmail.com wrote: You are welcome. Btw my name is wahib :) How do u intend to use this barcode code with camera thing? are you using your own camera preview code or calling built in camera app intent?? I am just stuck with this phase .. i hope its the last thing. Regards, wahib On 10/10/09,Abhishekabhishek.moh...@gmail.com wrote: Hey Wahid, Same code worked for me. Multiformatreader can read QR codes. Thanks a lot for help. Abhishek On Oct 9, 9:11 am,Abhishekabhishek.moh...@gmail.com wrote: Wahid, Thanks a lot brother. Is it possible for you to send you activity file to me onabhishek.moh...@gmail.com? I will keep you posted about my progress on this application. Abhishek On Oct 7, 7:42 pm, wahib haq wahib.t...@gmail.com wrote: hiabhishek!! I am a newbie and my first initiative is also building a simple barcode decoding module. I dont have a android phone so i have to go on a different path to do this barcode app thing. :S can you plz guide me what to be on right side of BufferedImage myImage = ... ?? I am using this code I have imported these ... import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.widget.TextView; import com.google.zxing.MonochromeBitmapSource; import com.google.zxing.MultiFormatReader; import com.google.zxing.Reader; import com.google.zxing.ReaderException; import com.google.zxing.client.androidtest.*; import com.google.zxing.common.BaseMonochromeBitmapSource; Bitmap bitmap = BitmapFactory.decodeResource(getResources(),R.drawable.bar5); Bitmap bitmap1 = BitmapFactory.decodeFile(file://sdcard/DCIM/Camera/2009-10-04 21.31.02.jpg); MultiFormatReader reader1=new MultiFormatReader();//For all barcode formats try { result=reader1.decode(new RGBMonochromeBitmapSource(bitmap)); tv.setText(result.getText()); } catch (Exception e) { tv.setText(Error occured !!); } } // I have tried it with reading bmp and jpeg image from pasting in res/drawable folder and it works fine with 1D barcode. Its not working with 2D and i dont know how to do it though multiformat i guess means it shud support 2D as well. Well this will solve ur problem. I also tried to read it with a sdcard image coz after all it has to fetch from the image taken by camera. but i dont have a camera and unable to push image in gallery after lots of tries so it still undone. Share anything else you cum to know abt barcode decoding task. Regards, wahib On 10/6/09,Abhishekabhishek.moh...@gmail.com wrote: Hello All, I am writing an application to scan a bar code. As a small module of it I am trying to decode the bar code form the image file stored as resource. (R.raw.bc02) where bc02.jpg is my bar code image file. I am usinghttp://code.google.com/p/zxing/wiki/DeveloperNotestowrite a program for decoding. I am stuck up at following step: i.e. reading the image as bufferedImage BufferedImage myImage = ...;
[android-beginners] Re: Reading/Decoding bar code stored in resources
Wahib.. sorry for the mistake in your name. Thanks for pointing out. 3 phases of my app 1) Scan picture(bar code) from camera store 2) Decode the barcode 3.) Search the product information and display. I am done with Part 2.. I think you are also working on same application if I am not wrong. Now I will concentrate on Part 1. Where are you stuck in Part1? What is the error if any? Please let me know. I will also keep you posted. Thanks, Abhishek On Oct 9, 10:36 pm, wahib haq wahib.t...@gmail.com wrote: You are welcome. Btw my name is wahib :) How do u intend to use this barcode code with camera thing? are you using your own camera preview code or calling built in camera app intent?? I am just stuck with this phase .. i hope its the last thing. Regards, wahib On 10/10/09,Abhishekabhishek.moh...@gmail.com wrote: Hey Wahid, Same code worked for me. Multiformatreader can read QR codes. Thanks a lot for help. Abhishek On Oct 9, 9:11 am,Abhishekabhishek.moh...@gmail.com wrote: Wahid, Thanks a lot brother. Is it possible for you to send you activity file to me onabhishek.moh...@gmail.com? I will keep you posted about my progress on this application. Abhishek On Oct 7, 7:42 pm, wahib haq wahib.t...@gmail.com wrote: hiabhishek!! I am a newbie and my first initiative is also building a simple barcode decoding module. I dont have a android phone so i have to go on a different path to do this barcode app thing. :S can you plz guide me what to be on right side of BufferedImage myImage = ... ?? I am using this code I have imported these ... import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.widget.TextView; import com.google.zxing.MonochromeBitmapSource; import com.google.zxing.MultiFormatReader; import com.google.zxing.Reader; import com.google.zxing.ReaderException; import com.google.zxing.client.androidtest.*; import com.google.zxing.common.BaseMonochromeBitmapSource; Bitmap bitmap = BitmapFactory.decodeResource(getResources(),R.drawable.bar5); Bitmap bitmap1 = BitmapFactory.decodeFile(file://sdcard/DCIM/Camera/2009-10-04 21.31.02.jpg); MultiFormatReader reader1=new MultiFormatReader();//For all barcode formats try { result=reader1.decode(new RGBMonochromeBitmapSource(bitmap)); tv.setText(result.getText()); } catch (Exception e) { tv.setText(Error occured !!); } } // I have tried it with reading bmp and jpeg image from pasting in res/drawable folder and it works fine with 1D barcode. Its not working with 2D and i dont know how to do it though multiformat i guess means it shud support 2D as well. Well this will solve ur problem. I also tried to read it with a sdcard image coz after all it has to fetch from the image taken by camera. but i dont have a camera and unable to push image in gallery after lots of tries so it still undone. Share anything else you cum to know abt barcode decoding task. Regards, wahib On 10/6/09,Abhishekabhishek.moh...@gmail.com wrote: Hello All, I am writing an application to scan a bar code. As a small module of it I am trying to decode the bar code form the image file stored as resource. (R.raw.bc02) where bc02.jpg is my bar code image file. I am usinghttp://code.google.com/p/zxing/wiki/DeveloperNotestowrite a program for decoding. I am stuck up at following step: i.e. reading the image as bufferedImage BufferedImage myImage = ...; MonochromeBitmapSource source = new BufferedImageMonochromeBitmapSource (myImage); I have written following code to read the image which works fine InputStream is= this.getApplicationContext().getResources ().openRawResource(R.raw.bc02); The run time object is of class android.content.res.AssetManager $AssetInputStream Can any help me in reading the file and decoding? Please let me know if I am doing correct or not. Thank you, Abhishek -- Wahib-ul-haq Communications Engineering Student, NUST, Pakistan.www.sizzlotech.com -- Wahib-ul-haq Communications Engineering Student, NUST, Pakistan.www.sizzlotech.com --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Reading/Decoding bar code stored in resources
feels good to see your reply. Its just an assignment for me. yes i am stuck with part 1. In the start i tried a lot with camera stuff and searched for source codes to display camera preview and take snap. I was successful with getting camera preview but either the image was not saved or the image taken was of very small size like thumbnail. so then i thought about using the built-in camera app. Then after few days of research i able to call the camera app as i click a button in my custom app. but now the issue is after taking snap i want to run my decode function.But i dont know how to exit the camera preview and call my decode() function:S so its here i am stuck with. I have posted it and i'll post it again. it wud be great if you could help me. Regards, wahib On 10/14/09, Abhishek abhishek.moh...@gmail.com wrote: Wahib.. sorry for the mistake in your name. Thanks for pointing out. 3 phases of my app 1) Scan picture(bar code) from camera store 2) Decode the barcode 3.) Search the product information and display. I am done with Part 2.. I think you are also working on same application if I am not wrong. Now I will concentrate on Part 1. Where are you stuck in Part1? What is the error if any? Please let me know. I will also keep you posted. Thanks, Abhishek On Oct 9, 10:36 pm, wahib haq wahib.t...@gmail.com wrote: You are welcome. Btw my name is wahib :) How do u intend to use this barcode code with camera thing? are you using your own camera preview code or calling built in camera app intent?? I am just stuck with this phase .. i hope its the last thing. Regards, wahib On 10/10/09,Abhishekabhishek.moh...@gmail.com wrote: Hey Wahid, Same code worked for me. Multiformatreader can read QR codes. Thanks a lot for help. Abhishek On Oct 9, 9:11 am,Abhishekabhishek.moh...@gmail.com wrote: Wahid, Thanks a lot brother. Is it possible for you to send you activity file to me onabhishek.moh...@gmail.com? I will keep you posted about my progress on this application. Abhishek On Oct 7, 7:42 pm, wahib haq wahib.t...@gmail.com wrote: hiabhishek!! I am a newbie and my first initiative is also building a simple barcode decoding module. I dont have a android phone so i have to go on a different path to do this barcode app thing. :S can you plz guide me what to be on right side of BufferedImage myImage = ... ?? I am using this code I have imported these ... import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.widget.TextView; import com.google.zxing.MonochromeBitmapSource; import com.google.zxing.MultiFormatReader; import com.google.zxing.Reader; import com.google.zxing.ReaderException; import com.google.zxing.client.androidtest.*; import com.google.zxing.common.BaseMonochromeBitmapSource; Bitmap bitmap = BitmapFactory.decodeResource(getResources(),R.drawable.bar5); Bitmap bitmap1 = BitmapFactory.decodeFile(file://sdcard/DCIM/Camera/2009-10-04 21.31.02.jpg); MultiFormatReader reader1=new MultiFormatReader();//For all barcode formats try { result=reader1.decode(new RGBMonochromeBitmapSource(bitmap)); tv.setText(result.getText()); } catch (Exception e) { tv.setText(Error occured !!); } } // I have tried it with reading bmp and jpeg image from pasting in res/drawable folder and it works fine with 1D barcode. Its not working with 2D and i dont know how to do it though multiformat i guess means it shud support 2D as well. Well this will solve ur problem. I also tried to read it with a sdcard image coz after all it has to fetch from the image taken by camera. but i dont have a camera and unable to push image in gallery after lots of tries so it still undone. Share anything else you cum to know abt barcode decoding task. Regards, wahib On 10/6/09,Abhishekabhishek.moh...@gmail.com wrote: Hello All, I am writing an application to scan a bar code. As a small module of it I am trying to decode the bar code form the image file stored as resource. (R.raw.bc02) where bc02.jpg is my bar code image file. I am usinghttp://code.google.com/p/zxing/wiki/DeveloperNotestowrite a program for decoding. I am stuck up at following step: i.e. reading the image as bufferedImage BufferedImage myImage = ...; MonochromeBitmapSource source = new BufferedImageMonochromeBitmapSource (myImage); I have written following code to read the image which works fine InputStream is= this.getApplicationContext().getResources ().openRawResource(R.raw.bc02); The run time object is of class android.content.res.AssetManager $AssetInputStream Can any help me in reading the file and decoding? Please let me
[android-beginners] Re: Reading/Decoding bar code stored in resources
Wahid, Thanks a lot brother. Is it possible for you to send you activity file to me on abhishek.moh...@gmail.com? I will keep you posted about my progress on this application. Abhishek On Oct 7, 7:42 pm, wahib haq wahib.t...@gmail.com wrote: hiabhishek!! I am a newbie and my first initiative is also building a simple barcode decoding module. I dont have a android phone so i have to go on a different path to do this barcode app thing. :S can you plz guide me what to be on right side of BufferedImage myImage = ... ?? I am using this code I have imported these ... import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.widget.TextView; import com.google.zxing.MonochromeBitmapSource; import com.google.zxing.MultiFormatReader; import com.google.zxing.Reader; import com.google.zxing.ReaderException; import com.google.zxing.client.androidtest.*; import com.google.zxing.common.BaseMonochromeBitmapSource; Bitmap bitmap = BitmapFactory.decodeResource(getResources(),R.drawable.bar5); Bitmap bitmap1 = BitmapFactory.decodeFile(file://sdcard/DCIM/Camera/2009-10-04 21.31.02.jpg); MultiFormatReader reader1=new MultiFormatReader();//For all barcode formats try { result=reader1.decode(new RGBMonochromeBitmapSource(bitmap)); tv.setText(result.getText()); } catch (Exception e) { tv.setText(Error occured !!); } } // I have tried it with reading bmp and jpeg image from pasting in res/drawable folder and it works fine with 1D barcode. Its not working with 2D and i dont know how to do it though multiformat i guess means it shud support 2D as well. Well this will solve ur problem. I also tried to read it with a sdcard image coz after all it has to fetch from the image taken by camera. but i dont have a camera and unable to push image in gallery after lots of tries so it still undone. Share anything else you cum to know abt barcode decoding task. Regards, wahib On 10/6/09,Abhishekabhishek.moh...@gmail.com wrote: Hello All, I am writing an application to scan a bar code. As a small module of it I am trying to decode the bar code form the image file stored as resource. (R.raw.bc02) where bc02.jpg is my bar code image file. I am usinghttp://code.google.com/p/zxing/wiki/DeveloperNotesto write a program for decoding. I am stuck up at following step: i.e. reading the image as bufferedImage BufferedImage myImage = ...; MonochromeBitmapSource source = new BufferedImageMonochromeBitmapSource (myImage); I have written following code to read the image which works fine InputStream is= this.getApplicationContext().getResources ().openRawResource(R.raw.bc02); The run time object is of class android.content.res.AssetManager $AssetInputStream Can any help me in reading the file and decoding? Please let me know if I am doing correct or not. Thank you, Abhishek -- Wahib-ul-haq Communications Engineering Student, NUST, Pakistan.www.sizzlotech.com --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Reading/Decoding bar code stored in resources
Hey Wahid, Same code worked for me. Multiformatreader can read QR codes. Thanks a lot for help. Abhishek On Oct 9, 9:11 am, Abhishek abhishek.moh...@gmail.com wrote: Wahid, Thanks a lot brother. Is it possible for you to send you activity file to me onabhishek.moh...@gmail.com? I will keep you posted about my progress on this application. Abhishek On Oct 7, 7:42 pm, wahib haq wahib.t...@gmail.com wrote: hiabhishek!! I am a newbie and my first initiative is also building a simple barcode decoding module. I dont have a android phone so i have to go on a different path to do this barcode app thing. :S can you plz guide me what to be on right side of BufferedImage myImage = ... ?? I am using this code I have imported these ... import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.widget.TextView; import com.google.zxing.MonochromeBitmapSource; import com.google.zxing.MultiFormatReader; import com.google.zxing.Reader; import com.google.zxing.ReaderException; import com.google.zxing.client.androidtest.*; import com.google.zxing.common.BaseMonochromeBitmapSource; Bitmap bitmap = BitmapFactory.decodeResource(getResources(),R.drawable.bar5); Bitmap bitmap1 = BitmapFactory.decodeFile(file://sdcard/DCIM/Camera/2009-10-04 21.31.02.jpg); MultiFormatReader reader1=new MultiFormatReader();//For all barcode formats try { result=reader1.decode(new RGBMonochromeBitmapSource(bitmap)); tv.setText(result.getText()); } catch (Exception e) { tv.setText(Error occured !!); } } // I have tried it with reading bmp and jpeg image from pasting in res/drawable folder and it works fine with 1D barcode. Its not working with 2D and i dont know how to do it though multiformat i guess means it shud support 2D as well. Well this will solve ur problem. I also tried to read it with a sdcard image coz after all it has to fetch from the image taken by camera. but i dont have a camera and unable to push image in gallery after lots of tries so it still undone. Share anything else you cum to know abt barcode decoding task. Regards, wahib On 10/6/09,Abhishekabhishek.moh...@gmail.com wrote: Hello All, I am writing an application to scan a bar code. As a small module of it I am trying to decode the bar code form the image file stored as resource. (R.raw.bc02) where bc02.jpg is my bar code image file. I am usinghttp://code.google.com/p/zxing/wiki/DeveloperNotestowrite a program for decoding. I am stuck up at following step: i.e. reading the image as bufferedImage BufferedImage myImage = ...; MonochromeBitmapSource source = new BufferedImageMonochromeBitmapSource (myImage); I have written following code to read the image which works fine InputStream is= this.getApplicationContext().getResources ().openRawResource(R.raw.bc02); The run time object is of class android.content.res.AssetManager $AssetInputStream Can any help me in reading the file and decoding? Please let me know if I am doing correct or not. Thank you, Abhishek -- Wahib-ul-haq Communications Engineering Student, NUST, Pakistan.www.sizzlotech.com --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Reading/Decoding bar code stored in resources
You are welcome. Btw my name is wahib :) How do u intend to use this barcode code with camera thing? are you using your own camera preview code or calling built in camera app intent?? I am just stuck with this phase .. i hope its the last thing. Regards, wahib On 10/10/09, Abhishek abhishek.moh...@gmail.com wrote: Hey Wahid, Same code worked for me. Multiformatreader can read QR codes. Thanks a lot for help. Abhishek On Oct 9, 9:11 am, Abhishek abhishek.moh...@gmail.com wrote: Wahid, Thanks a lot brother. Is it possible for you to send you activity file to me onabhishek.moh...@gmail.com? I will keep you posted about my progress on this application. Abhishek On Oct 7, 7:42 pm, wahib haq wahib.t...@gmail.com wrote: hiabhishek!! I am a newbie and my first initiative is also building a simple barcode decoding module. I dont have a android phone so i have to go on a different path to do this barcode app thing. :S can you plz guide me what to be on right side of BufferedImage myImage = ... ?? I am using this code I have imported these ... import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.widget.TextView; import com.google.zxing.MonochromeBitmapSource; import com.google.zxing.MultiFormatReader; import com.google.zxing.Reader; import com.google.zxing.ReaderException; import com.google.zxing.client.androidtest.*; import com.google.zxing.common.BaseMonochromeBitmapSource; Bitmap bitmap = BitmapFactory.decodeResource(getResources(),R.drawable.bar5); Bitmap bitmap1 = BitmapFactory.decodeFile(file://sdcard/DCIM/Camera/2009-10-04 21.31.02.jpg); MultiFormatReader reader1=new MultiFormatReader();//For all barcode formats try { result=reader1.decode(new RGBMonochromeBitmapSource(bitmap)); tv.setText(result.getText()); } catch (Exception e) { tv.setText(Error occured !!); } } // I have tried it with reading bmp and jpeg image from pasting in res/drawable folder and it works fine with 1D barcode. Its not working with 2D and i dont know how to do it though multiformat i guess means it shud support 2D as well. Well this will solve ur problem. I also tried to read it with a sdcard image coz after all it has to fetch from the image taken by camera. but i dont have a camera and unable to push image in gallery after lots of tries so it still undone. Share anything else you cum to know abt barcode decoding task. Regards, wahib On 10/6/09,Abhishekabhishek.moh...@gmail.com wrote: Hello All, I am writing an application to scan a bar code. As a small module of it I am trying to decode the bar code form the image file stored as resource. (R.raw.bc02) where bc02.jpg is my bar code image file. I am usinghttp://code.google.com/p/zxing/wiki/DeveloperNotestowrite a program for decoding. I am stuck up at following step: i.e. reading the image as bufferedImage BufferedImage myImage = ...; MonochromeBitmapSource source = new BufferedImageMonochromeBitmapSource (myImage); I have written following code to read the image which works fine InputStream is= this.getApplicationContext().getResources ().openRawResource(R.raw.bc02); The run time object is of class android.content.res.AssetManager $AssetInputStream Can any help me in reading the file and decoding? Please let me know if I am doing correct or not. Thank you, Abhishek -- Wahib-ul-haq Communications Engineering Student, NUST, Pakistan.www.sizzlotech.com -- Wahib-ul-haq Communications Engineering Student, NUST, Pakistan. www.sizzlotech.com --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Reading/Decoding bar code stored in resources
hi abhishek !! I am a newbie and my first initiative is also building a simple barcode decoding module. I dont have a android phone so i have to go on a different path to do this barcode app thing. :S can you plz guide me what to be on right side of BufferedImage myImage = ... ?? I am using this code I have imported these ... import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.widget.TextView; import com.google.zxing.MonochromeBitmapSource; import com.google.zxing.MultiFormatReader; import com.google.zxing.Reader; import com.google.zxing.ReaderException; import com.google.zxing.client.androidtest.*; import com.google.zxing.common.BaseMonochromeBitmapSource; Bitmap bitmap = BitmapFactory.decodeResource(getResources(),R.drawable.bar5); Bitmap bitmap1 = BitmapFactory.decodeFile(file://sdcard/DCIM/Camera/2009-10-04 21.31.02.jpg); MultiFormatReader reader1=new MultiFormatReader();//For all barcode formats try { result=reader1.decode(new RGBMonochromeBitmapSource(bitmap)); tv.setText(result.getText()); } catch (Exception e) { tv.setText(Error occured !!); } } // I have tried it with reading bmp and jpeg image from pasting in res/drawable folder and it works fine with 1D barcode. Its not working with 2D and i dont know how to do it though multiformat i guess means it shud support 2D as well. Well this will solve ur problem. I also tried to read it with a sdcard image coz after all it has to fetch from the image taken by camera. but i dont have a camera and unable to push image in gallery after lots of tries so it still undone. Share anything else you cum to know abt barcode decoding task. Regards, wahib On 10/6/09, Abhishek abhishek.moh...@gmail.com wrote: Hello All, I am writing an application to scan a bar code. As a small module of it I am trying to decode the bar code form the image file stored as resource. (R.raw.bc02) where bc02.jpg is my bar code image file. I am using http://code.google.com/p/zxing/wiki/DeveloperNotes to write a program for decoding. I am stuck up at following step: i.e. reading the image as bufferedImage BufferedImage myImage = ...; MonochromeBitmapSource source = new BufferedImageMonochromeBitmapSource (myImage); I have written following code to read the image which works fine InputStream is= this.getApplicationContext().getResources ().openRawResource(R.raw.bc02); The run time object is of class android.content.res.AssetManager $AssetInputStream Can any help me in reading the file and decoding? Please let me know if I am doing correct or not. Thank you, Abhishek -- Wahib-ul-haq Communications Engineering Student, NUST, Pakistan. www.sizzlotech.com --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-beginners] Re: Reading/Decoding bar code stored in resources
hey i just tried decoding a QR code and it worked fine as well. you just need to import /zxing/qrcode.QRcode and then create it instanse like i did with MultiFormatReader. I also tried decoding a datamatrix image using its class DataMatrixReader but its not working. but i am happy up till now. On 10/8/09, wahib haq wahib.t...@gmail.com wrote: hi abhishek !! I am a newbie and my first initiative is also building a simple barcode decoding module. I dont have a android phone so i have to go on a different path to do this barcode app thing. :S can you plz guide me what to be on right side of BufferedImage myImage = ... ?? I am using this code I have imported these ... import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.widget.TextView; import com.google.zxing.MonochromeBitmapSource; import com.google.zxing.MultiFormatReader; import com.google.zxing.Reader; import com.google.zxing.ReaderException; import com.google.zxing.client.androidtest.*; import com.google.zxing.common.BaseMonochromeBitmapSource; Bitmap bitmap = BitmapFactory.decodeResource(getResources(),R.drawable.bar5); Bitmap bitmap1 = BitmapFactory.decodeFile(file://sdcard/DCIM/Camera/2009-10-04 21.31.02.jpg); MultiFormatReader reader1=new MultiFormatReader();//For all barcode formats try { result=reader1.decode(new RGBMonochromeBitmapSource(bitmap)); tv.setText(result.getText()); } catch (Exception e) { tv.setText(Error occured !!); } } // I have tried it with reading bmp and jpeg image from pasting in res/drawable folder and it works fine with 1D barcode. Its not working with 2D and i dont know how to do it though multiformat i guess means it shud support 2D as well. Well this will solve ur problem. I also tried to read it with a sdcard image coz after all it has to fetch from the image taken by camera. but i dont have a camera and unable to push image in gallery after lots of tries so it still undone. Share anything else you cum to know abt barcode decoding task. Regards, wahib On 10/6/09, Abhishek abhishek.moh...@gmail.com wrote: Hello All, I am writing an application to scan a bar code. As a small module of it I am trying to decode the bar code form the image file stored as resource. (R.raw.bc02) where bc02.jpg is my bar code image file. I am using http://code.google.com/p/zxing/wiki/DeveloperNotes to write a program for decoding. I am stuck up at following step: i.e. reading the image as bufferedImage BufferedImage myImage = ...; MonochromeBitmapSource source = new BufferedImageMonochromeBitmapSource (myImage); I have written following code to read the image which works fine InputStream is= this.getApplicationContext().getResources ().openRawResource(R.raw.bc02); The run time object is of class android.content.res.AssetManager $AssetInputStream Can any help me in reading the file and decoding? Please let me know if I am doing correct or not. Thank you, Abhishek -- Wahib-ul-haq Communications Engineering Student, NUST, Pakistan. www.sizzlotech.com -- Wahib-ul-haq Communications Engineering Student, NUST, Pakistan. www.sizzlotech.com --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---