Read CSV Resource File: Android Programming




About this tutorial:

Video duration: 21:25
Import a CSV file into an Android Application from the raw resource folder and store the contents in custom data objects for use in Java.
Support videos via Patreon:

Steps:
1. Have data in a spread sheet. Clean out ‘,’s from the data, then save as CSV file.

2. In Android project, create new resoure directory
– type raw: gives name “raw”
– copy in file w/ copy/paste

3. Write code to read it.
– access the file via getResources().openRawResource(R.raw.vehicles_simple);
– use a BufferedReader to read one line at a time.
– call String.split() on the full…

Post Author: OfficeTutes.com

Apple lover, ICT and LEAN consultant, MS Office lecturer My other website with video tutorials - Tutorials, guides and news for iPhones and iPads

24 thoughts on “Read CSV Resource File: Android Programming

    Tabish Shaikh

    (December 24, 2018 - 2:18 am)

    how can I show that data into a listview?

    Kexin Jing

    (December 24, 2018 - 2:18 am)

    is there any way that I can output a csv file from android studio from an arraylist? I stock in this question…

    Rehaan Mazid

    (December 24, 2018 - 2:18 am)

    Thank You. The video was really good and really informative!!!

    Andres Rodriguez

    (December 24, 2018 - 2:18 am)

    Thank You so much! This is a huge help.

    Frank Haubenreisser

    (December 24, 2018 - 2:18 am)

    "No, well actually it's more interesting than I thought. It crashed. Which is FANTASTIC now we can see why."
    DrBFraser

    I appreciate the fact though that you purposefully produce terrible code so we are all reminded of how NOT to do it!

    Sampelmind81

    (December 24, 2018 - 2:18 am)

    Hey from Germany, very good tutorial! Iam not able to see any files in data/data…it gives me:"run-as:Could not set capabilities: Operation not permitted". iam running Ubuntu 18.04 and my real device ist a Samsung. Ive searched trough the ethernet but wasnt able to found a solution. Any Ideas? Thanks, Tobias

    Priyansh Ramnani

    (December 24, 2018 - 2:18 am)

    Thank You!

    Suraj Weththasinghe

    (December 24, 2018 - 2:18 am)

    Thank you…

    Fluffy Unicornz

    (December 24, 2018 - 2:18 am)

    How would you display the data into a dropdown? Nice video though

    Tales Lopes

    (December 24, 2018 - 2:18 am)

    Thanks! That'a exactly what i was looking for!
    It will help me a lot.

    Jesus Mejia Avilez

    (December 24, 2018 - 2:18 am)

    Hi!
    how can i put them now to name a kind of tables? or how can I print the variables in a text view?

    Krofz

    (December 24, 2018 - 2:18 am)

    Thank you! Very clear to me

    Viral A P

    (December 24, 2018 - 2:18 am)

    Amazing man.
    The way you explain stuff is appreciation worthy.
    I got my many other doubts too cleared.

    Linden Swan

    (December 24, 2018 - 2:18 am)

    Very Helpful and very clear Thanks!

    Alex Lucard

    (December 24, 2018 - 2:18 am)

    I cannot continue watching your video you're obsessive clicking is very annoying

    Andrés Felipe Echeverri Guevara

    (December 24, 2018 - 2:18 am)

    wtf = what a terrible failure…. you made my day!

    Tolga SAGLIK

    (December 24, 2018 - 2:18 am)

    This works great. Could you also provide a tutorial for writing data to a CSV file considering a fix to FileNotFoundException?

    Mark Mitchell

    (December 24, 2018 - 2:18 am)

    I am struggling to get the ArrayList to display in a ListView. The adapter keeps coming up with an error, could you show how to display it in a list? I am very new to all this.

    Infocentro Usmajac

    (December 24, 2018 - 2:18 am)

    Can you elaborate on how to display the results, let`s say as text displayed within the app or a chart? Very much appreciated, thank you.

    Rohan Tilekar

    (December 24, 2018 - 2:18 am)

    Thank you made the work easier and simple.

    puneet dua

    (December 24, 2018 - 2:18 am)

    Thank you – Simple , Precise & Clear !

    Dessy Christin

    (December 24, 2018 - 2:18 am)

    Thank you for your tutorial…

    But can you help how to save the result data to file .csv in Android Studio ?
    Thank you

    Sibusiso Mayalo

    (December 24, 2018 - 2:18 am)

    What a life saver! I have been searching for this for a VERY long time. Thanks man!

Leave a Reply

Your email address will not be published. Required fields are marked *