I am writing a financial calculator and part of my code is printing
out an amortization table for 25 - 30 years. Some times there can be
up to 2000 rows on the page. Here is my code to do this part:
-----------------------------------------------------------------
void updateAmort(){
Debug.startMethodTracing("amort");
tl.removeAllViews();
int loops = myMortgage.getLoops();
int j=0;
ArrayList<String[]> tribbleList = myMortgage.getAmort();
for (int i=0;i<loops;i=i+k){
String[] tribble = (String[]) tribbleList.get(i);
TableRow junk =new TableRow (this);
tl.addView(junk, j);
for (int f=0;f<6;f++) {
TextView junk2 = new TextView (this);
junk2.setText(tribble[f]);
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
Float width = metrics.density*82;
int pixelsint = width.intValue();
if (f==3) {
junk2.setClickable(true);
}
junk2.setWidth(pixelsint);
junk2.setTextSize(1, 9);
junk2.setTypeface(Typeface.MONOSPACE);
junk2.setTextColor(Color.BLACK);
junk.addView(junk2);
}
j++;
}
Debug.stopMethodTracing();
}
}
--------------------------------------------------------------------------------------------------------------
I wasn't sure whether to attach my trace file. I can if anyone is
interested. What I was hoping was now that I have learned a bunch
about the android system I am trying to tighten up my performance. Can
anyone offer some hints on how this code can be executed quicker? The
data is in an ArrayList of Strings and I just print them out one by
one.
Should I try to add them as the person scrolls down? Any other ways to
make it more user friendly...I saw a mention of a progress bar in my
looking in the android development site..should I add one of those?
Any other comments for someone who hasn't coded since Protel was king??
Connie
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en