Hi,
Below is the link which shows how my UI looks:
http://i56.tinypic.com/6p89q8.jpg
You can see those articles now. Article are coming from RSS of blog.
So i m making question more simpler:
I wrote code this way as follows: (Im giving code in short)
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.articleslist);
dialog = ProgressDialog.show(Articles.this, "","Loading. Please
wait...", true);
new InsertDataTask().execute(this);
}
private class InsertDataTask extends AsyncTask<Context, Void,
ArrayList> {
private Context context;
protected Cursor doInBackground(final Context... args){
//fetch all the data from db and out it in ArrayList and return
it
}
protected void onPostExecute(final ArrayList c){
//now here is inserted for loop for rendering those
articles in UI
tablev = findViewById(R.id.articleslist);
for(){
tr = new TableRow(context);
tr.setLayoutParams(new
LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
tr.setClickable(true);
tr.setFocusable(true);
// code now create textviews and imageviews
and insert those image into tr
//Finally the tr is inserted into table
tablev.addView(tr);
}
}
When i execute the code.
Because that for loop takes 2/3 seconds to render the UI. My UI gets
hangs for those 2/3 seconds
I think you are clear now
On Nov 16, 6:45 pm, Kumar Bibek <[email protected]> wrote:
> Alternate colors: Listview can handle that.
>
> Couldn't understand much from what you have explained, but I am sure,
> there's something wrong you are doing. Please be a bit more elaborate on
> what exactly are you doing and what is not working.
>
> What's an "article" by the way.
>
> On Tue, Nov 16, 2010 at 7:11 PM, umakantpatil <[email protected]>wrote:
>
>
>
>
>
>
>
>
>
> > Hi all,
>
> > I have to draw list of 30 articles. I tired using list view but there
> > was some problem as I wanted to user alternate colors like first is
> > white and 2nd is blue where as again 3rd is white and 4th is blue and
> > it goes on..
>
> > So I decided to have scrollview and table into it.
> > I set the view using setcontentview which shows loading dialog.
> > then in aysnc task's "doInBackground" method i fetch all articles into
> > the object and then in "onPostExecute"
> > I run a for loop on the object and in each loop i make table row
> > insert article and then insert row into table.
> > and then dismiss loading dialog box.
>
> > As i have tabular view in my app and If i remove loading dialog box.
> > While the UI is rendered if someone clicks on other tab. UI is hanged
> > up,
> > After loading all table rows It goes to other tab.
>
> > Can some one help me with this ? Even after using asynctask why this
> > happens ?
>
> > --
> > 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]<android-developers%2Bunsubs
> > [email protected]>
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.com
--
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