Skip to content Skip to sidebar Skip to footer

How To Show Spanish Text In Textview?

I have the following code and i try to show text in text-view which in Spanish. When I run app then it showing ? at some places. Can anyone tell me detailed procedure for showing

Solution 1:

Your readTxt method is wrong. You are returning a String representation of your ByteArrayOutputStream and not the actual String.

Try reading the input stream into a ByteArrayInputStream and then getting the byte array from it and on that return new String(byteArray);

private String readTxt(){               
InputStreaminputStream= getResources().openRawResource(R.raw.info);
        InputStreamReaderisReader=newInputStreamReader(inputStream);

        BufferedReaderreader=newBufferedReader(isReader);

        StringBufferbuffer=newStringBuffer();
        Stringline=null;
        while ((line = reader.readLine()) != null)
        {
            buffer.append(line);
            buffer.append("\n");
        }
        buffer.deleteCharAt(buffer.length() - 1); // Delete the last new line char// TODO: Don't forget to close all streams and readersreturn buffer.toString();   
    }

Post a Comment for "How To Show Spanish Text In Textview?"