I have two classes one of them that I pass to sends two parameters which are
1- file URL
2- file name
because I dont want to create this class for every file I have
first class passes the parameters from OnItemClickListener
list.setOnItemClickListener(new ListView.OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
if (position == 0) {
// pass parameters file name & file url
}
the second class
public void onClick(View v) {
// starting new Async Task
new DownloadFileFromURL().execute(file_url);
}
OutputStream output=new FileOutputStream(new File(dir, filename));
You can do this by following code :
first class passes the parameters from OnItemClickListener
the second class