From 1251c37e968ee4e9ade6d9e87b42ebfcc0a81e46 Mon Sep 17 00:00:00 2001 From: AjitSingh Date: Wed, 5 Jul 2017 00:25:25 +0530 Subject: [PATCH] Set crash id before reporting it --- .../src/main/java/com/singhajit/sherlock/core/Sherlock.java | 3 ++- .../java/com/singhajit/sherlock/core/investigation/Crash.java | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/sherlock/src/main/java/com/singhajit/sherlock/core/Sherlock.java b/sherlock/src/main/java/com/singhajit/sherlock/core/Sherlock.java index bc1c31e..9e61c0c 100644 --- a/sherlock/src/main/java/com/singhajit/sherlock/core/Sherlock.java +++ b/sherlock/src/main/java/com/singhajit/sherlock/core/Sherlock.java @@ -62,7 +62,8 @@ private static void analyzeAndReportCrash(Throwable throwable) { Log.d(TAG, "Analyzing Crash..."); CrashAnalyzer crashAnalyzer = new CrashAnalyzer(throwable); Crash crash = crashAnalyzer.getAnalysis(); - instance.database.insertCrash(CrashRecord.createFrom(crash)); + int crashId = instance.database.insertCrash(CrashRecord.createFrom(crash)); + crash.setId(crashId); instance.crashReporter.report(new CrashViewModel(crash)); Log.d(TAG, "Crash analysis completed!"); } diff --git a/sherlock/src/main/java/com/singhajit/sherlock/core/investigation/Crash.java b/sherlock/src/main/java/com/singhajit/sherlock/core/investigation/Crash.java index 08296da..46f76f6 100644 --- a/sherlock/src/main/java/com/singhajit/sherlock/core/investigation/Crash.java +++ b/sherlock/src/main/java/com/singhajit/sherlock/core/investigation/Crash.java @@ -71,4 +71,8 @@ public int getId() { public Date getDate() { return date; } + + public void setId(int id) { + this.id = id; + } }