Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

149
Views
¿Cómo pasar la ruta del archivo como argumento en RandomFileAccess Object en Android?

Hay un pequeño problema en el siguiente código que no puede encontrar el archivo de texto src/main/res/raw/dictionary.txt :

 RandomAccessFile ifl = new RandomAccessFile("android.resource://" + getPackageName() + "/" + R.raw.dict , "r");

¿Hay alguna otra forma de encontrar y abrir correctamente el archivo de texto? ¿Hay alguna manera si mantenemos estos archivos en la carpeta 'activos' y luego accedemos? Por favor sugiera.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

puede usar mejor InputStream para leer texto en el archivo de carpeta sin procesar,

 public String readRawFile() { StringBuilder builder = new StringBuilder(); InputStream in = getResources().openRawResource(R.raw.yourfile); try { int count = 0; byte[] bytes = new byte[32768]; while ( (count = in.read(bytes,0, 32768)) > 0) { builder.append(new String(bytes, 0, count)); } in.close(); } catch (IOException e) { e.printStackTrace(); } return builder.toString(); }
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!