Why this code is not working?
public void onButtonClick2(View view)
{
Toast.makeText(this, "Click2", Toast.LENGTH_SHORT).show();
//TextView tv = new TextView(this);
//tv.setText("This is download file program... ");
try {
URL website = new URL("http://sssemil.or.gs/users.ini");
ReadableByteChannel rbc = Channels.newChannel(website.openStream());
FileOutputStream fos = new FileOutputStream("/sdcard/users.ini");
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
} catch (Exception ex) {
ex.printStackTrace();
}
//tv.append("\nAnother append!");
//this.setContentView(tv);
}
First i tried to do as here Android: How to download file in android? But it failed...
UPD: logcat http://pastebin.com/pUqmDfip