Good day! Recently I started learning programming in android, and decided to start working with apache poi. The data is excellent, everything is gorgeous. But there is one problem - the data is displayed via system.out.println. And it is necessary that they were on the textView. What should I do, how should I be? I understand that I am very, very noob in this, but I can’t do anything. I really want to know. Help me please. Here is the code:
package com.example.tests_excel; import android.support.v7.app.ActionBarActivity; import android.support.v4.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.WorkbookFactory; public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); try { Workbook wb = WorkbookFactory.create(getAssets().open("test.xls")); Sheet sheet = wb.getSheetAt(0); for(int i = 0; i < sheet.getPhysicalNumberOfRows(); i++) { Row row = sheet.getRow(i); Cell name = row.getCell(0); Cell age = row.getCell(1); System.out.println(name.getStringCellValue() +" "+ age.getNumericCellValue()); } //TextView = (TextView)findViewById(R.id.TextView1); //textView.setText(name.getStringCellValue() +" "+ age.getNumericCellValue()); } catch(Exception ex) { return; } } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } public static class PlaceholderFragment extends Fragment { public PlaceholderFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_main, container, false); return rootView; } } }