trying to convert a code block from C# to Java (Android)
<p>I'm trying to convert a method that I have written i C to java for Android.</p>

<p>The following coding is what I'm trying to convert in Java:</p>

<pre><code>public Map()
{
    string line;
    int maxRowLevels, maxColLevels;

    StreamReader file;
    file = File.OpenText("map.txt");

    line = file.ReadLine();
    line = file.ReadLine();
    maxRowLevels = System.Convert.ToInt32(line) - 1;

    line = file.ReadLine();
    line = file.ReadLine();    
    maxColLevels = System.Convert.ToInt32(line) - 1;

    line = file.ReadLine();

    map = new char[maxRowLevels+1,maxColLevels+1,screenRows,screenCols];

    for (int rowCurrentLevel = 0; rowCurrentLevel&lt;=maxRowLevels; rowCurrentLevel++)
    {
        for (int currentRow = 0; currentRow&lt;screenRows; currentRow++)
        {
            line = file.ReadLine();
            for (int colCurrentLevel = 0; colCurrentLevel&lt;=maxColLevels; colCurrentLevel++)
            {
                for (int currentCol = 0; currentCol&lt;screenCols; currentCol++)
                {
                    map[rowCurrentLevel, colCurrentLevel,currentRow, currentCol] = line[colCurrentLevel*screenCols + currentCol];
                }
            }
        }          
    }
    file.Close();    
}
</code></pre>

<p>My attempt to conversion is the following code:</p>

<pre><code>public Map(Context context)
{
    String line;
    int maxRowLevels, maxColLevels;
    int maxRowLevels, maxColLevels;

    InputStream inputFile;
    BufferedReader file;

    inputFile = context.getAssets().open("map.txt");
    file = new BufferedReader(new InputStreamReader(inputFile, "UTF-8"));

    line = file.readLine();
    line = file.readLine();
    maxRowLevels = Integer.parseInt(line)-1;

    line = file.readLine();
    line = file.readLine();     
    maxColLevels = Integer.parseInt(line)-1;

    line = file.readLine();

    mapa = new char[maxRowLevels+1][maxColLevels+1][screenRows][screenCols];

    for (int rowCurrentLevel = 0; rowCurrentLevel&lt;=maxRowLevels; rowCurrentLevel++)
    {
        for (int currentRow = 0; currentRow&lt;screenRows; currentRow++)
        {
            line = file.readLine();
            for (int colCurrentLevel = 0; colCurrentLevel&lt;=maxColLevels; colCurrentLevel++)
            {
                for (int currentCol = 0; currentCol&lt;screenCols; currentCol++)
                {
                    mapa[rowCurrentLevel][colCurrentLevel][currentRow][currentCol] = line[colCurrentLevel*screenCols + currentCol];
                }
            }
        }          
    }
    inputFile.close();
    file.close();
}
</code></pre>

<p>It seems everything is correct except for this line that drops this error: "the type of the expression Must Be an array type string But It resolved to string"</p>

<p><code>mapa[rowCurrentLevel][colCurrentLevel][currentRow][currentCol] = line[colCurrentLevel*screenCols + currentCol]</code>;</p>

<p>Can anyone tell me how to fix it?
I think that it will be silly, forgive me but I am a begginer in Java.</p>

<p>Thanks in advance.</p>
