0

Hi I had created an android app which contains a slider drawer.I want to add dynamic contents to slider drawer(load image,text from server etc )when app runs .Is it possible?? please help me and thanks :)

Bennett
  • 73
  • 9

2 Answers2

1

I have written a demo on github.In the demo,the NavigationDrawerFragment file is like your slider drawer ,the main list in the drawer is come from this code spinnet :

mDrawerListView.setAdapter(new ArrayAdapter<String>(
            getActionBar().getThemedContext(),
            android.R.layout.simple_list_item_1,
            android.R.id.text1,
            new String[]{
                    getString(R.string.title_section1),
                    getString(R.string.title_section2),
                    getString(R.string.title_section3),
            }));

So you could replace it with a data load function and load dynamic contents in the file.:

public void loadDynamicData(){
   //1. show a progress bar when the data is not ready.
   //2. use AsyncTask to load data in background.
   //3. when data is ready,replace the progress bar with data. 
}

If you also want to add an actionbar-pulltorefresh library, you can add this to the drawer.It's very easy. And if you want to load the image logo (such as user's avatar),you could use the picasso.

penkzhou
  • 1,200
  • 13
  • 30
  • I want to add add slider drawer layout to my project from the library project I created with 2 or 3 line code.is it possible?? – Bennett Apr 05 '14 at 05:23
  • You mean have written a slide drawer library project and you want to import the slide drawer class from the slide drawer library project? – penkzhou Apr 05 '14 at 05:26
  • ya exactly.I am struggling with last 1 month to solve this. so please help me if u have any idea about it. plz :) – Bennett Apr 05 '14 at 05:43
  • I already created a library project.so now i want to add slider drawer functions in library and then tell me how to call this function in another project from library?? – Bennett Apr 05 '14 at 05:45
  • Maybe you could get some idea from the [SlidingMenu library](https://github.com/jfeinstein10/SlidingMenu). – penkzhou Apr 05 '14 at 05:46
  • is it possible to make custom view ?? – Bennett Apr 05 '14 at 05:52
0

If you use ListView in slider drawer then you need to load data via asynctask and make a custom Listview.

So, What step you need to do.

  1. Read Data via Asynctask.
  2. Create Custom adapter by this Reading data.
  3. Set this adapter in listvoew.

Also check this link

Community
  • 1
  • 1
Md Abdul Gafur
  • 6,213
  • 2
  • 27
  • 37
  • I want to add add slider drawer layout to my project from the library project I created with 2 or 3 line code.is it possible?? – Bennett Apr 05 '14 at 05:22