检索导航历史为当前运行的应用程序 [英] Retrieving the navigation history for the current running application
问题描述
我想以此来显示他是目前在App的用户。举例来说,如果我有活动A
, b活动
,活动ç
等等......如果他浏览到活动è
(为前)。他应该能看到他是如何落在了对当前历史屏幕 - (从首页 - > E或从首页 - > A-> B,然后e或同样的历史是precise ..)..我已阅读生根粉活动栈开发者论坛,但有仍没有得到的方式挂接到的活动...帮助堆栈跟踪信息,请..
I want a way to show the user where he is currently in the App. Example, if I have activity A
,activity B
, activity C
and so on...If he navigates to activity E
(for ex)..He should be able to see the history of how he has landed up on the current screen--(From Home->E or from home->a->b and then e or likewise. The history to be precise..)..I have read abt the activity stack on developer forums but have still not got a way to hook up into the stack trace of the activity...Help please..
推荐答案
您可以使用的getStackTrace()
获取进行导航infromation:
You can use getStackTrace()
for getting navigates infromation:
StackTraceElement traceElement = Thread.currentThread()
.getStackTrace()[3];
String logText = String.format(CLASS_METHOD_LINE_FORMAT,
traceElement.getClassName(), traceElement.getMethodName(),
traceElement.getLineNumber(), traceElement.getFileName());
Log.d("messg", logText);
或
猫/data/anr/traces.txt
cat /data/anr/traces.txt
但你需要有root权限来修改文件 /数据/
but You need to have root access to modify the files in /data/
这篇关于检索导航历史为当前运行的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!