I'm still working on my application that has to store RSS data localy. So far i managed to create a local database and parse the online RSS feed. I also managed to put this information in the database so now the app will also be available while being offline.
However i can't seem to figure out how to do the following: I have 2 buttons, one of them reads the database titles and will go to a detailed page of your selection (still working on that)
My current problem is that i can't seem to add a loading bar to pop up on the screen while the application is downloading the data from the internet. The screen is just blank for like 10 seconds and then the list pops up. here is the code that i'm using:
public class SynchDB_Activity extends ListActivity {
public List<Message> messages;
public List<String> titles;
//ProgressDialog dialog = ProgressDialog.show(SynchDB_Activity.this, "", "Downloading data...", true);
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.animal_list_view);
loadFeed();
}
private void loadFeed(){
try{
BaseFeedParser parser = new BaseFeedParser();
messages = parser.parse();
List<String> titles = new ArrayList<String>(messages.size());
DBAdapter db = new DBAdapter(this);
for (Message msg : messages){
titles.add(msg.getTitle());
db.addRow(
msg.getTitle(),
msg.getDescription(),
"bla",
"http:/",
msg.getLink());
}
//dialog.dismiss();
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.row,titles);
this.setListAdapter(adapter);
} catch (Throwable t){
Log.e("AndroidNews",t.getMessage(),t);
}
}
So this code works and puts all the data in the local database. However i just cant make that loading bar working and it's driving me crazy.
If anyone could help me out i would be gratefull!!! I've been googling all day and nothing seems to do the trick....
many thanks
edit: As you can see in the code i display the list when its done. This is not nececary, but from the moment i remove the ArrayAdapter the app won't work anymore.
Keep in mind that this all is quite new for me and i think that the main part where things are going wrong is useing the different layouts...