Riyanto Nugroho
- Forum posts: 1
May 23, 2017, 3:04:09 PM via Website
May 23, 2017 3:04:09 PM via Website
hi all iam trying to modifiy signature apk to send signature over wifi to windows share
signature was created but it cannot send automatically to windows share
private class MyCopy extends AsyncTask<String, String, String> {
String z = "";
String username = "", password = "", servername = "", filestocopy = "";
@Override
protected void onPreExecute() {
SharedPreferences sharedPreferences = PreferenceManager
.getDefaultSharedPreferences(context);
String name = sharedPreferences.getString("storedName", "YourName");
username = null;
password = null;
servername = "smb://" +name;
filestocopy = "/sdcard/tanda_tangan/tanda_tangan.png";
}
@Override
protected String doInBackground(String... params) {
File A = new File(filestocopy);
String filename = A.getName();
NtlmPasswordAuthentication auth1 = new NtlmPasswordAuthentication(
servername, username, password);
try {
SmbFile sfile = new SmbFile(servername + "/" + filename, auth1);
//if (!sfile.exists())
// sfile.createNewFile();
sfile.connect();
InputStream in = new FileInputStream(A);
SmbFileOutputStream sfos = new SmbFileOutputStream(sfile);
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) {
sfos.write(buf, 0, len);
}
in.close();
sfos.close();
z = "File copied successfully";
} catch (Exception ex) {
z = z + " " + ex.getMessage().toString();
}
return z;
}
}
what was wrong ?
pls help and this is the event
just tell me if you want whole project i will send it
mGetSign.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Log.v("tag", "Panel Saved");
view.setDrawingCacheEnabled(true);
mSignature.save(view, StoredPath);
dialog.dismiss();
Toast.makeText(getApplicationContext(), "sukses tersimpan", Toast.LENGTH_SHORT).show();
MyCopy mycopy = new MyCopy();
mycopy.execute("");
recreate();
}
});
Recommended editorial content
With your consent, external content is loaded here.
By clicking on the button above, you agree that external content may be displayed to you. Personal data may be transmitted to third-party providers in the process. You can find more information about this in our Privacy Policy.