Skip to content

Commit

Permalink
when error actiivity is shown users will be able to copy the error in…
Browse files Browse the repository at this point in the history
… the clipboard
  • Loading branch information
Plamen5kov committed Dec 1, 2015
1 parent f5583fe commit cf2904e
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/src/com/tns/ErrorReport.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import android.app.Activity;
import android.app.PendingIntent;
import android.app.PendingIntent.CanceledException;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.GradientDrawable;
Expand Down Expand Up @@ -151,7 +153,7 @@ void buildUI()
layout.addView(txtHeader);

Intent intent = activity.getIntent();
String msg = intent.getStringExtra(EXTRA_ERROR_REPORT_MSG);
final String msg = intent.getStringExtra(EXTRA_ERROR_REPORT_MSG);

TextView txtErrorMsg = new TextView(context);
txtErrorMsg.setText(msg);
Expand All @@ -176,7 +178,22 @@ public void onClick(View v)
activity.finish();
}
});

Button copyToClipboard = new Button(context);
copyToClipboard.setText("Copy to clipboard");
copyToClipboard.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{

ClipboardManager clipboard = (ClipboardManager) activity.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("nsError", msg);
clipboard.setPrimaryClip(clip);
}
});

layout.addView(copyToClipboard);
layout.addView(btnClose);
}

Expand Down

0 comments on commit cf2904e

Please sign in to comment.