sample/src/com/handmark/pulltorefresh/samples/PullToRefreshExpandableListActivity.java
@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_ptr_expandable_list);

		mPullRefreshListView = (PullToRefreshExpandableListView) findViewById(R.id.pull_refresh_expandable_list);

		// Set a listener to be invoked when the list should be refreshed.
		mPullRefreshListView.setOnRefreshListener(new OnRefreshListener<ExpandableListView>() {
			@Override
			public void onRefresh(PullToRefreshBase<ExpandableListView> refreshView) {
				// Do work to refresh the list here.
				new GetDataTask().execute();
			}
		});

		for (String group : mGroupStrings) {
			Map<String, String> groupMap1 = new HashMap<String, String>();
			groupData.add(groupMap1);
			groupMap1.put(KEY, group);

			List<Map<String, String>> childList = new ArrayList<Map<String, String>>();
			for (String string : mChildStrings) {
				Map<String, String> childMap = new HashMap<String, String>();
				childList.add(childMap);
				childMap.put(KEY, string);
			}
			childData.add(childList);
		}

		mAdapter = new SimpleExpandableListAdapter(this, groupData, android.R.layout.simple_expandable_list_item_1,
				new String[] { KEY }, new int[] { android.R.id.text1 }, childData,
				android.R.layout.simple_expandable_list_item_2, new String[] { KEY }, new int[] { android.R.id.text1 });
		setListAdapter(mAdapter);
	}
@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_ptr_expandable_list);

		mPullRefreshListView = (PullToRefreshExpandableListView) findViewById(R.id.pull_refresh_expandable_list);

		// Set a listener to be invoked when the list should be refreshed.
		mPullRefreshListView.setOnRefreshListener(new OnRefreshListener<ExpandableListView>() {
			@Override
			public void onRefresh(PullToRefreshBase<ExpandableListView> refreshView) {
				// Do work to refresh the list here.
				new GetDataTask().execute();
			}
		});

		for (String group : mGroupStrings) {
			Map<String, String> groupMap1 = new HashMap<String, String>();
			groupData.add(groupMap1);
			groupMap1.put(KEY, group);

			List<Map<String, String>> childList = new ArrayList<Map<String, String>>();
			for (String string : mChildStrings) {
				Map<String, String> childMap = new HashMap<String, String>();
				childList.add(childMap);
				childMap.put(KEY, string);
			}
			childData.add(childList);
		}

		mAdapter = new SimpleExpandableListAdapter(this, groupData, android.R.layout.simple_expandable_list_item_1,
				new String[] { KEY }, new int[] { android.R.id.text1 }, childData,
				android.R.layout.simple_expandable_list_item_2, new String[] { KEY }, new int[] { android.R.id.text1 });
		setListAdapter(mAdapter);
	}
@ Override public void onCreate ( Bundle savedInstanceState ) { super . onCreate ( savedInstanceState ) ; setContentView ( R . layout . activity_ptr_expandable_list ) ; mPullRefreshListView = ( PullToRefreshExpandableListView ) findViewById ( R . id . pull_refresh_expandable_list ) ; // Set a listener to be invoked when the list should be refreshed. mPullRefreshListView . setOnRefreshListener ( new OnRefreshListener < ExpandableListView > ( ) { @ Override public void onRefresh ( PullToRefreshBase < ExpandableListView > refreshView ) { // Do work to refresh the list here. new GetDataTask ( ) . execute ( ) ; } } ) ; for ( String group : mGroupStrings ) { Map < String , String > groupMap1 = new HashMap < String , String > ( ) ; groupData . add ( groupMap1 ) ; groupMap1 . put ( KEY , group ) ; List < Map < String , String > > childList = new ArrayList < Map < String , String > > ( ) ; for ( String string : mChildStrings ) { Map < String , String > childMap = new HashMap < String , String > ( ) ; childList . add ( childMap ) ; childMap . put ( KEY , string ) ; } childData . add ( childList ) ; } mAdapter = new SimpleExpandableListAdapter ( this , groupData , android . R . layout . simple_expandable_list_item_1 , new String [ ] { KEY } , new int [ ] { android . R . id . text1 } , childData , android . R . layout . simple_expandable_list_item_2 , new String [ ] { KEY } , new int [ ] { android . R . id . text1 } ) ; setListAdapter ( mAdapter ) ; }
Called when the activity is first created.
Called when the activity is first created .