我正在使用Youtube下载程序,我使用 girdview.setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView absListView, int scrollState) {
// Pause fetcher to ensure smoother scrolling when flinging // You can ignore this part
if (scrollState == AbsListView.OnScrollListener.SCROLL_STATE_FLING) {
mImageFetcher.setPauseWork(true);
} else {
mImageFetcher.setPauseWork(false);
}
}
@Override
public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
final int _lastItem = firstVisibleItem + visibleItemCount;
if (_lastItem > 0 && totalItemCount > 0)
if (_lastItem == albums.size() && !endOfAlbums && lastItem != _lastItem) {
lastItem = _lastItem;
// Last item is fully visible.
loadAlbums();
}
}
});
return view;
}
private void loadAlbums() {
if (currentPage == 0) {
albums.clear();
endOfAlbums = false;
lastItem = 0;
// get new releases
progressLayout.setVisibility(View.VISIBLE);
} else
progressLoadMore.setVisibility(View.VISIBLE);
if (Utility.isNetworkAvailable(getActivity())) {
new Thread(new Runnable() {
@Override
public void run() {
// get the serverAlbums
ArrayList<Album> serverAlbums = ServerAPI.getAllAlbums(session.getLanguage(), currentPage);
if (serverAlbums.size() > 0)
albums.addAll(serverAlbums);
else
endOfAlbums = true;
currentPage++;
myHandler.post(updateRunnable);
}
}).start();
updateRunnable = new Runnable() {
@Override
public void run() {
if (albums.size() > 0) {
imageAdapter.notifyDataSetChanged();
// get listview current position - used to maintain scroll position
int currentPosition = girdview.getFirstVisiblePosition();
// Setting new scroll position
girdview.smoothScrollToPosition(currentPosition + 1, 0);
} else
tvNoAlbums.setVisibility(View.VISIBLE);
progressLayout.setVisibility(View.GONE);
progressLoadMore.setVisibility(View.GONE);
}
};
} else {
Toast.makeText(getActivity(), R.string.check_connectivity, Toast.LENGTH_SHORT).show();
progressLayout.setVisibility(View.GONE);
progressLoadMore.setVisibility(View.GONE);
}
}
但是当我启动程序并在该字段中放置一个网址时,我收到了此错误:
路径中的非法字符
Path.combine
答案 0 :(得分:0)
您不需要添加"\\"
,因为Path.Combine()会为您提供这些内容。
修改强>
示例:Path.Combine(Application.StartupPath, "hello");
返回类似C:\path\to\exe\hello\