to fix a credit card reader compatibility with android phones

by Xiong Android » Wed, 17 Feb 2010 03:02:23 GMT


Sponsored Links
 hello,

do you want to support the work on hardware or software?

regards
mike





>



Other Threads

1. 3D Model Loading Problem

Hi everyone,

I'm developing an android application for my thesis and I need to load
a 3D model into it. I have decided to use the .obj file structure as
input. After some searching in the internet and also here in the
Android Developers group I found an object loader provided by the
project android-gl (http://code.google.com/p/android-gl/). Its
ObjectLoader.java file provides the following load methods:

public Model load(InputStream in)
        throws IOException

public Model load(String file)
        throws IOException

My problem at the moment is to correctly load the model into my
application so that I can see it on the display. I have integrated the
loader call inside the onDrawFrame method:

public void onDrawFrame(GL10 gl) {

                gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
                gl.glFrontFace(GL10.GL_CW);
                gl.glEnable(GL10.GL_CULL_FACE);
                gl.glCullFace(GL10.GL_BACK);

                for(int loop = 0; loop < 2; loop++) {

                        if(loop==0) {
                                gl.glViewport(0, 0, w, h);
                                gl.glMatrixMode(GL10.GL_PROJECTION);
                                gl.glLoadIdentity();
                                gl.glOrthof(-1.0f, 1.0f, -1.0f * h / w, 1.0f * 
h / w, -2.0f,
10.0f);
                        }

                        if(loop==1) {
                                gl.glViewport(0, 65, w/2, w/2);
                                gl.glMatrixMode(GL10.GL_PROJECTION);
                                gl.glLoadIdentity();
                                GLU.gluPerspective(gl, 45.0f, (float) w / 
(float) h, -2.0f,
10.0f);
                        }

                        gl.glMatrixMode(GL10.GL_MODELVIEW);
                        gl.glLoadIdentity();

                        gl.glClear(GL10.GL_DEPTH_BUFFER_BIT);

                        if(loop==0) {
                                gl.glPushMatrix();
                                        
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
                                        
gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
                                        gl.glBindTexture(GL10.GL_TEXTURE_2D, 
textureId);

                                        gl.glTranslatef(0.0f, 0.0f, 10.0f);

                                        gl.glVertexPointer(2, GL10.GL_FLOAT, 0, 
vertices);
                                        gl.glEnable(GL10.GL_TEXTURE_2D);
                                        gl.glTexCoordPointer(2, GL10.GL_FLOAT, 
0, texCoords);
                                        gl.glDrawElements(GL10.GL_TRIANGLES, 
mIndices.length,
GL10.GL_UNSIGNED_SHORT, indices);
                                gl.glPopMatrix();
                                gl.glDisable(GL10.GL_TEXTURE_2D);
                        }


                        // NOW THE PART WITH THE LOADER


                        if(loop==1) {
                                gl.glPushMatrix();
                                        gl.glTranslatef(0.0f, 0.0f, 5.0f);
                                        // loading 3D model
                                        try {
                --------->                 loader.load(new 
FileInputStream("sdcard/
pixbag.obj"));
                                        } catch (FileNotFoundException e) {
                                           e.printStackTrace();
                                        } catch (Exception e) {
                                           e.printStackTrace();
                                        }
                                gl.glPopMatrix();
                        }
                }

                gl.glDisable(GL10.GL_CULL_FACE);
                gl.glFlush();
}

Since I'm working with the android emulator I wanted to load the obj
file out of the emulated sdcard device. But when I'm trying to push a
file onto it using DDMS in eclipse the console returns the following
lines:

Failed to push the item(s).
(null)

I also tried to push the file using the command line tool without
result :( So for now without the model I'm even not sure if the loader
does what it's supposed to do.

Another way I tried was to have the obj file in the assets folder of
my eclipse project from where I also load my texture file. So I have
modified the above-mentioned lines concerning the loader to:

InputStream in = getAssets().open("pixbag.obj");
loader.load(in);

This revision neither worked. I still cannot see the 3d model. Any
help and advise on how I can load and display the 3d data in the
emulator is more than appreciated!

thanks in advance,
Sadi






-- 

2. javax.sound alternative

Hi All,

wanted to know is there any alternative of javax.sound.sampled package
specially AudioSystem and TargetDataLine class. Here is the sample
code in java I am referring to :

                1       AudioFormat af = new
AudioFormat(AudioFormat.Encoding.PCM_SIGNED, 8000.0F, 16, 1, 2,
8000.0F, false);
                2       DataLine.Info info = new
DataLine.Info(TargetDataLine.class, af);
                3       TargetDataLine line = (TargetDataLine) 
AudioSystem.getLine(info);
                4       line.open(af, 800);
                5       SoundRecorder recorder = new SoundRecorder(line, this,
seconds);                          //  this class records the sound
and returns recording in byte array
                6       recorder.start();
                7       recorder.join();
                8
                9       // Write with headers
                10      ByteArrayInputStream soundbytes = new
ByteArrayInputStream(recorder.getRecording());
                11      ByteArrayOutputStream byteswithheaders = new
ByteArrayOutputStream();
                12      AudioSystem.write(new AudioInputStream(soundbytes, af,
soundbytes.available() / 2), AudioFileFormat.Type.WAVE,
byteswithheaders);
                13      return byteswithheaders.toByteArray();


So far I am able to record the data in format specified in step 1. and
convert it into byte array.
My doubts:
->I recorded sound without using Dataline class, will that make any
difference
->Which class should I use in Android, instead of step 12.
-> or some one has any other idea??

-- 

3. How usb hot plugin message pass to android desktop?

4. Regarding suspend blockers

5. Manual IP address setting in RIL.

6. Android bluetooth supported only on UART?

7. Adding new Language will case problems