마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

workbook,Cell[ ] row, 그리고 get 구문에서 막혔습니다 ㅠㅠ

0 추천
package com.example.examlast;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.FileAsyncHttpResponseHandler;

import jxl.Cell;

import jxl.WorkbookSettings;
import jxl.read.biff.BiffException;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Adapter;
import android.widget.ProgressBar;
import android.widget.Toast;

import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import cz.msebera.android.httpclient.Header;

public class MainActivity extends AppCompatActivity {

    RecyclerView recyclerView;
    Adapter adapter;
    AsyncHttpClient client;
    Workbook workbook;
    List<String> titles,descriptions,imageUrl;
    ProgressBar progressBar;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        String url = "https://github.com/bikashthapa01/excel-reafer-android-app/blob/master/story.xls?raw=true";



        recyclerView = findViewById(R.id.listOfData);
        progressBar = findViewById(R.id.progressBar);


        titles = new ArrayList<>();
        imageUrl = new ArrayList<>();



        client = new AsyncHttpClient();
        progressBar.setVisibility(View.VISIBLE);
        client.get(url,new FileAsyncHttpResponseHandler(this){



            @Override
            public void onFailure(int statusCode, Header[] headers, Throwable throwable, File file){

                progressBar.setVisibility(View.GONE);
                Toast.makeText(MainActivity.this,"Download Failed.", Toast.LENGTH_SHORT).show();

            }

            @Override
            public void onSuccess(int statuscode,Header[] headers, File file){

                progressBar.setVisibility(View.GONE);
                Toast.makeText(MainActivity.this,"FileDownloaded. ", Toast.LENGTH_SHORT).show();

                WorkbookSettings ws = new WorkbookSettings();
                ws.setGCDisabled(true);

                if(file != null){

                    try {
                            workbook = workbook.getWorkbook(file);
                            Sheet sheet = workbook.getSheet(0);
                            for(int i = 0; i < sheet.getRows();i++){


                                 Cell[] row = sheet.getRow(i);
                                 titles.add(row[0].getContents());
                                 descriptions.add(row[1].getContents());
                                 imageUrl.add(row[2].getContents());

                        }

                            showDate();

                        Log.d("Tag","onSuccess: "+titles);

                    } catch (IOException e){
                        e.printStackTrace();
                    } catch (BiffException e){
                        e.printStackTrace();
                    }
                }
            }
        });
    }
    private void showDate() {
        adapter = (Adapter) new com.example.examlast.Adapter(this,titles,descriptions,imageUrl);
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        recyclerView.setAdapter((RecyclerView.Adapter) adapter);
    }
}
현재 
if(file != null){
구문 이후 try 구문 안에서 getWorkbook,getRows,그리고 Cell있는 줄이 오류가 발생합니다 ㅠㅠ 디버그만 5시간 넘어가서 너무 힘들어서 정말 죄송하지만 이렇게 질문드립니다..ㅠㅠ 
 
혹시 도움이 될까봐 오류로그 사진이라도 올리겠습니다.
고수님들 한번만 부탁드려도 될까요...?ㅠㅠ

mk8627 (170 포인트) 님이 2020년 5월 19일 질문

답변 달기

· 글에 소스 코드 보기 좋게 넣는 법
· 질문에 대해 추가적인 질문이나 의견이 있으면 답변이 아니라 댓글로 달아주시기 바랍니다.
표시할 이름 (옵션):
개인정보: 당신의 이메일은 이 알림을 보내는데만 사용됩니다.
스팸 차단 검사:
스팸 검사를 다시 받지 않으려면 로그인하거나 혹은 가입 하세요.
...