How to make spreadsheet application

General topics about the Android-Platform itself.
Coding issues please to the subforum right below.

How to make spreadsheet application

Postby hys235 » Mon Jun 28, 2010 11:23 am

Hello folks,

I'm interested in creating a spreadsheet application for school research. And, I would like to hold on a column with one finger and move another figer to view around all columns while the column that is held stays at the same position on the screen.

I'm beginner in Android platform(I did some tutorials). I don't know where to start and can't outline how to do this. The part I'm having most trouble is 'how to create spreadsheet UI". Without HTML and JavaScript, I can't figure out how to create spreadsheet looking application on Android.

What are the things I need to know and what are the steps involved to do this?

Thanks guys. Cheers!
hys235
Freshman
Freshman
 
Posts: 3
Joined: Mon Jun 28, 2010 11:14 am

Top

Re: How to make spreadsheet application

Postby blundell » Wed Jun 30, 2010 9:34 am

Just had a quick read of your post.

I would recommend a table layout
http://developer.android.com/reference/android/widget/TableLayout.html

You ask for it to be scrollable, I'm not 100% in this area but:

For vertical scrolling you can just encase your table with a scroll layout
http://developer.android.com/reference/android/widget/ScrollView.html

If you wish to implement horizontal scrolling you will have to use the onTouch events (this then supersedes your scroll layout)
http://developer.android.com/guide/topics/ui/ui-events.html
http://developer.android.com/reference/android/view/View.OnTouchListener.html

One way would to remove the left column add the right column on a right drag touch event. Prob using:
http://developer.android.com/reference/android/view/View.html#setVisibility(int)
but I'm sure there is better ways.

Just a quick idea anyway, enjoy the reading :wink:
User avatar
blundell
Master Developer
Master Developer
 
Posts: 1610
Joined: Tue Nov 18, 2008 12:58 pm
Location: UK

Re: How to make spreadsheet application

Postby hys235 » Fri Jul 02, 2010 12:11 pm

Thanks for the information. I think I'm getting grasp of it.

Now, I'm wondering how do it display existing data in the table. I'm planning to use TableLayout to make the spread sheet. For instance, if I open an existing file with some data, how do I display them on the table?

I would do this in PHP:
<table>
<?php
for ($i = 0; $i < len($data); $i++) {
echo "<tr><td>" . $data[$i] . "</td></tr>";
}
?>
</table>

Can layout XML files can be dynamically produced with a Java class under Android project? How should I implement this?

Thanks again!
hys235
Freshman
Freshman
 
Posts: 3
Joined: Mon Jun 28, 2010 11:14 am

Re: How to make spreadsheet application

Postby blundell » Fri Jul 02, 2010 12:41 pm

Yes it can.

However with your PHP code you are actually writing new table row's and not appending to existing.

In android to append to an existing table row you would do something like

*PSUEDO*
tablelayout.xml
Code: Select all
<tableRow android:id="@id+/tableRow1">
</tableRow>
<tableRow android:id="@id+/tableRow2">
</tableRow>


MyTable.class
Code: Select all
Array tableRows = {R.id.tableRow1, R.id.tableRow2};
for ($i = 0; $i < len($data); $i++) {
    TableRow myRow = (TableRow) findViewById(tableRows [i]);
    myRow.setText(data[i]);
}


Or something along those lines, just keep referring to the reference material it'll help you alot:
http://developer.android.com/reference/ ... leRow.html
User avatar
blundell
Master Developer
Master Developer
 
Posts: 1610
Joined: Tue Nov 18, 2008 12:58 pm
Location: UK

Top

Return to General

Who is online

Users browsing this forum: No registered users and 1 guest