# How to show table in Android application?



## ermacwins (Jan 19, 2012)

Hi

Can someone help getting a table to display on Android devices please? The table is made in excel which serves the purpose of helping non Arabic speaking people to pronounce words in Arabic. It was made in excel because of the ease of making a table. Could have done it on word but it needs to be viewed natively on Android without making it an image file.... The idea is for it to show on all screen sizes from small screen devices to tablet screen sizes.

I don't want to view the document on a phone but to integrate the table into an app.

Exception maybe if the table could be made into a transparent table in an image format?

http://www.sendspace.com/file/9oiclx

Thanks


----------



## JBirdVegas (Jun 11, 2011)

Great idea but your table is not going to work in Android... as a general rule if you make a Doc that looks good on your computer it won't look good on android device.

You should instead present as a ListView. Use an ArrayAdapter and a custom layout with an imageView of your symbol then two textviews for your explanation.


----------



## JBirdVegas (Jun 11, 2011)

ermacwins said:


> I don't want to view the document on a phone but to integrate the table into an app.


I was thinking about this comment... I love it.

And in that spirit I spent all morning thinking about how you should present this list. I came up with a few ideas:

1) the ListView I suggested earlier... which will probably be the simplest way
2) A GridView would be the android version of a Table

But those are just ways to present the data to the user... you need a method to get the data to your application for display. For this you have several better options than displaying that table.

/* smartest because you can update the data without updating the app, app updates should be code or visual improvements only */
1) You can pull the data from the internet (easiest way would be use JSON to parse info from, could be anywhere but github offers a RAW view of webpages that can be used to host JSON docs). This way if you wanted to include more data then you presently have you can just update the data on the web, and when your users load the app data will be current. The downside is this requires an internet connection... take that into consideration (maybe you keep a default list like 2 describes if no connection if found).

/* easiest */
2) Add three Arrays in your Resources... The images would be an int array, as it would really be a reference to R.drawable.xyz, and the pronunciations would be String arrays... Requires updating the apk with any data additions or changes, however this won't require an internet connection for the data to be displayed (maybe your users are idk in a desert slightly outside of cell range? just another thing to consider)

/* worst way */
3) While you could just do the entire app without much code, you could do the entire app from within an XML layout, of coarse you are back to having to perform major updates to the app when simple data changes, needs further explanation or you just want to include more data... This route is not recommended for data that can be displayed in a dynamic fashion.


----------



## bancelina (Sep 11, 2012)

Thanks JBirdVegas. I have been searching this and you finished my search


----------



## yarly (Jun 22, 2011)

Use SQLite + http://stackoverflow.com/questions/4968226/show-data-in-table-view-in-android


----------



## ermacwins (Jan 19, 2012)

JBirdVegas said:


> I was thinking about this comment... I love it.
> 
> And in that spirit I spent all morning thinking about how you should present this list. I came up with a few ideas:
> 
> ...


Thanks for the indepth reply, really appreciate it. The data will be static so I think grid view will be the best option


----------

