this is a very basic question, as I am just beginning with Android.
When I click a button I want to show a list of articles saved on my device and the user can choose one of them. BUT if there aren’t any, I want to show a “Download” button to allow user to download the articles.
I don’t know how to do the layouts – should I call a new activityForResult with a ListActivity intent ? but then, in case there are no articles, how will I show the button?
Thank you
I can give you brief idea.Then you will have to try to implement it using references on internet.If you will come to a problem,we all are happy to help you,but at least you should put some efforts in coding.
So you will have to have a button,a listview and another button in xml layout.
A button (say btn_ShowArticles) is for its click to populate the listview.
A listview (say articleList) is for showing list of articles.
another button (say btn_download) is to let user download articles if there aren’t found any.
Now you will have to catch button click of btn_ShowArticles and there,you will have to fill the listview using an adapter.
you can check if the adapter is null or not.If it is null then you can show btn_Download and set listview invisible.
Else you can set btn_Download invisible and populate listview.
You can code to download the article in on click of btn_Download.