Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8958201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:09:28+00:00 2026-06-15T15:09:28+00:00

I want to read a csv file with separator !. But the moment I

  • 0

I want to read a csv file with separator “!”. But the moment I run following code in my android application, the whole application hangs. Please provide me help to solve the problem.

Input File looks like following, when opened in notepad:

/////////////////////////////////////////////////////////


Line Number"!Shift!"QC Operator"!"Line Operator"!"Printing Operator"!"Product 
Group"!"Product Series"!Product!" Type of Defect"!"PCBType"!CORRECTIVE ACTION (CA)
1!DAY!Deepak!Chetan!Arun!TIMER!MM30XX!55Q!NO Solder!POWER!REWORK
2!NIGHT!Kajal!Kajal!Ashish!TEMP!MM10XX!55Q!Less solder!LOGIC!Replacement
3!!Kavita!Mahesh G!B.C!COUNTER!TC!EM306A!Dry solder!DISPLAY!NA
4!!Madhuri!Mahesh.P!Pabitra!PLC!PID !EM368 !IC PIN SOLDER SHORT!CARD!
5!!Namita!Namita!Sachin!METER!XT!EM368-C!Tombs toning!!
!!Sneha!Naveen!Sayali!DPM!800!MF16 !One side open !!

///////////////////////////////////////////////////////

Code for reading the file :

    public void ReadConfigFile() throws IOException 
{      
    File myFile = new File(Environment.getExternalStorageDirectory() + File.separator + "QCVerification"+ File.separator+"List of Entries.csv");
    FileInputStream fIn = new FileInputStream(myFile);
    BufferedReader myReader = new BufferedReader(
            new InputStreamReader(fIn));
    String aDataRow = "";
    ArrayList<String> FileWholeData = new ArrayList<String>();
    FileWholeData.removeAll(null);
    while ((aDataRow = myReader.readLine()) != null) 
    {
        FileWholeData.add(aDataRow);
    }
    MyQcDataStructure = new QCDataStructure();
    for(Integer __index = 0;__index <FileWholeData.size();__index++)
    {   
        String TempString = "";
        TempString = FileWholeData.get(__index);
        StringTokenizer tokenizer = new StringTokenizer(TempString,"!");   
        int columnIndex = 0;   
        while (tokenizer.hasMoreTokens()) 
        {                  
            switch (columnIndex) 
            {     
            case 0:   
                MyQcDataStructure.QCLineNo.add(tokenizer.nextToken());
                break;
            case 1:
                    MyQcDataStructure.QCShift.add(tokenizer.nextToken());
                    break;
            case 2:
                    MyQcDataStructure.QCQCOPer.add(tokenizer.nextToken());
                    break;
            case 3:
                    MyQcDataStructure.QCLineOper.add(tokenizer.nextToken());
                    break;
            case 4:
                    MyQcDataStructure.QCPrintingOper.add(tokenizer.nextToken());
                    break;
            case 5:
                    MyQcDataStructure.QCProductGorup.add(tokenizer.nextToken());
                    break;
            case 6:
                    MyQcDataStructure.QCProductSeries.add(tokenizer.nextToken());
                    break;
            case 7:
                    MyQcDataStructure.QCProduct.add(tokenizer.nextToken());
                    break;
            case 8:
                    MyQcDataStructure.QCPDefect.add(tokenizer.nextToken());
                    break;
            case 9:
                    MyQcDataStructure.QCPCBType.add(tokenizer.nextToken());
                    break;
            case 10:
                    MyQcDataStructure.QCCA.add(tokenizer.nextToken());
                    break;
            }                      
            columnIndex++; 
        }
        break;
    }
    String aBuffer;
    aBuffer = "";
    for(int __secondIndex = 0;__secondIndex < MyQcDataStructure.QCLineNo.size();__secondIndex++)
    {
        aBuffer = aBuffer + MyQcDataStructure.QCLineNo.get(__secondIndex);
        aBuffer = aBuffer + "$";
        aBuffer = aBuffer + MyQcDataStructure.QCShift.get(__secondIndex);
        aBuffer = aBuffer + "$";
        aBuffer = aBuffer + MyQcDataStructure.QCQCOPer.get(__secondIndex);
        aBuffer = aBuffer + "$";
        aBuffer = aBuffer + MyQcDataStructure.QCLineOper.get(__secondIndex);
        aBuffer = aBuffer + "$";
        aBuffer = aBuffer + MyQcDataStructure.QCPrintingOper.get(__secondIndex);
        aBuffer = aBuffer + "$";
        aBuffer = aBuffer + MyQcDataStructure.QCProductGorup.get(__secondIndex);
        aBuffer = aBuffer + "$";
        aBuffer = aBuffer + MyQcDataStructure.QCProductSeries.get(__secondIndex);
        aBuffer = aBuffer + "$";
        aBuffer = aBuffer + MyQcDataStructure.QCProduct.get(__secondIndex);
        aBuffer = aBuffer + "$";
        aBuffer = aBuffer + MyQcDataStructure.QCPDefect.get(__secondIndex);
        aBuffer = aBuffer + "$";
        aBuffer = aBuffer + MyQcDataStructure.QCPCBType.get(__secondIndex);
        aBuffer = aBuffer + "$";
        aBuffer = aBuffer + MyQcDataStructure.QCCA.get(__secondIndex);
        aBuffer = aBuffer + "$";

    }
    txtData.setText(aBuffer);
    myReader.close();
    Toast.makeText(getBaseContext(),
            "Done reading santosh SD 'mysdfile.txt'",
            Toast.LENGTH_SHORT).show();
}   

But the application hangs when following code runs in my application:

while (tokenizer.hasMoreTokens()) 
        {                  
            switch (columnIndex) 
            {  

Any help to solve this problem will be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T15:09:30+00:00Added an answer on June 15, 2026 at 3:09 pm

    You don’t have a default case in your switch block. So when the column reaches 11, you have an infinite loop.

    Add

    default : 
        tokenizer.nextToken();
        break;
    

    To your switch statement, or do

    while (tokenizer.hasMoreTokens() && columnIndex <= 10)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following sample CSV file rc,u,s,ui,gh m,1,8,0,12 n,3,0,0,7 d,1,1,8,0 I want to read
I have a text file. I want read that file. But In that if
I want to read in a csv file, filter it based on the values
I have a CSV file that I want to read into a List. Here's
I want to read a CSV file's columns directly into variables. The result should
I have a CSV file with 5 sheets. I want to read the second
I have a CSV file that I want to read with Ruby and create
I want to read a .csv file in python. I don't know if the
I'm using RoR 2.3.8, I want to read a .csv file with is in
I want to read a csv file into an access database , here is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.