Yes String constant has a limit in java.
So what you can do is copy the String string into a text file and paste it into the Assets root folder and read from the file in the following way.
public String ReadFromfile(String fileName, Context context) { StringBuilder returnString = new StringBuilder(); InputStream fIn = null; InputStreamReader isr = null; BufferedReader input = null; try { fIn = context.getResources().getAssets() .open(fileName, Context.MODE_WORLD_READABLE); isr = new InputStreamReader(fIn); input = new BufferedReader(isr); String line = ""; while ((line = input.readLine()) != null) { returnString.append(line); } } catch (Exception e) { e.getMessage(); } finally { try { if (isr != null) isr.close(); if (fIn != null) fIn.close(); if (input != null) input.close(); } catch (Exception e2) { e2.getMessage(); } } return returnString.toString(); }
Rahul jain
source share