My app opens a png image. When I send to print, my application stop and my console (logcat) just show the message:
Fatal signal 6 (SIGABRT), code -6 in tid 13555 (RenderThread)
In the tablet screen it shows: Application Not Responding (ANR).
I can print the image, but my app stop and I need to restart the session.
I'm looking for a solution.
Some code:
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.imprimir) {
Bitmap bitmap = Util.screenShot(mWebView);
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 40, bytes);
File file = new File(Environment.getExternalStorageDirectory() + File.separator + "screenshot.png");
try {
file.createNewFile();
FileOutputStream fo = new FileOutputStream(file);
fo.write(bytes.toByteArray());
fo.close();
} catch (IOException e) {
e.printStackTrace();
}
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
intent.setType("image/png");
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
startActivity(intent);
}
return super.onOptionsItemSelected(item);
}