Q:

Passing attributes to shader

I am using OPEN GL ES2.0 on Android. 
I need pass two attributes to shader, one for position, one for texture coordinates, 
//vertices for position
vertices = new float[12] { -1.0f, -1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f,
        -1.0f, 1.0f, 1.0f, -1.0f, 1.0f };

//vertices for texture coordinates. 
txtVertices = new float[12] { 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f,
        0.0f, 1.0f, 1.0f, 0.0f, 1.0f };

//Passing to shader. 
    glVertexAttribPointer(texCoordHandle, 2, GL_FLOAT, GL_FALSE, 0,
        txtVertices);
glVertexAttribPointer(vPositionHandle, 2, GL_FLOAT, GL_FALSE, 0, vertices);

glEnableVertexAttribArray(vPositionHandle);
glEnableVertexAttribArray(texCoordHandle);

glDrawArrays(GL_TRIANGLES, 0, 6);

glDisableVertexAttribArray(vPositionHandle);
glDisableVertexAttribArray(texCoordHandle);

What's the problem of this piece of code?  it's like the second one override the first one, and only one vertices are passed into my shader. 

A:

 it seems that ther is no error in the code you posted.   may have errors in shaders or in some other part
 don't you pass 3 floats for vertexposition(x,y,z)

