{"id":182,"date":"2013-08-04T21:01:41","date_gmt":"2013-08-05T05:01:41","guid":{"rendered":"http:\/\/www.android-decompiler.com\/blog\/?p=182"},"modified":"2018-12-19T13:41:22","modified_gmt":"2018-12-19T21:41:22","slug":"jeb-plugin-how-to-jump-to-an-activity","status":"publish","type":"post","link":"https:\/\/www.pnfsoftware.com\/blog\/jeb-plugin-how-to-jump-to-an-activity\/","title":{"rendered":"JEB Plugin How-To: Jump to an Activity"},"content":{"rendered":"<p>The API that shipped with JEB 1.3 allows direct access to the Android Manifest. Here, we are just demonstrating how some of the new methods that shipped with the API. This plugin allows a user to jump from an Activity tag in the manifest to the corresponding code in the Assembly view:<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\n#? name=Jump to an Activity, shortcut=Ctrl+Shift+J\r\n\r\nfrom jeb.api import IScript\r\nfrom jeb.api.ui import View\r\nfrom jeb.api.ui import CodePosition\r\n\r\n\r\nclass JumpToActivity(IScript):\r\n\r\n  def run(self, jeb):\r\n\r\n    # basic requirements\r\n    ui = jeb.getUI()\r\n    if not ui:\r\n      return\r\n\r\n    if jeb.getApiVersion() &lt; 2:\r\n      print 'Please upgrade to JEB 1.3'\r\n      return\r\n\r\n    ui.focusView(View.Type.MANIFEST)\r\n    v = ui.getView(View.Type.MANIFEST)\r\n    if not v:\r\n      print 'No Manifest'\r\n      return\r\n\r\n    # whole copy of the Manifest\r\n    text = v.getText()\r\n\r\n    # retrieve the package name\r\n    pname = ''\r\n    pos = text.find('package=&quot;')\r\n    if pos &gt;= 0:\r\n      pos += 9\r\n      pos1 = text.find('&quot;', pos)\r\n      if pos1 &gt;= 0:\r\n        pname = text&#x5B;pos:pos1]\r\n\r\n    # the Activity name should be the on-caret item\r\n    aname = v.getActiveItem()\r\n    if not aname:\r\n      print 'Please position the caret on the Activity name'\r\n      return\r\n\r\n    # absolute class classname\r\n    if aname.startswith('.'):\r\n      if not pname:\r\n        print 'Package name not found'\r\n        return\r\n      aname = pname + aname\r\n\r\n    ui.focusView(View.Type.ASSEMBLY)\r\n    a = ui.getView(View.Type.ASSEMBLY)\r\n    if not a:\r\n      print 'No Assembly view'\r\n      return\r\n\r\n    # internal class name\r\n    classname = 'L' + aname.replace('.', '\/') + ';'\r\n    if not a.setCodePosition(CodePosition(classname)):\r\n      print 'Class not found: '+aname\r\n      ui.focusView(View.Type.MANIFEST)\r\n\r\n<\/pre>\n<p>Feel free to experiment with the script, and customize it to your needs. Leave a comment if you have any questions. More sample scripts will be posted in the next week to showcase more other capabilities of API v2.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The API that shipped with JEB 1.3 allows direct access to the Android Manifest. Here, we are just demonstrating how some of the new methods that shipped with the API. This plugin allows a user to jump from an Activity tag in the manifest to the corresponding code in the Assembly view: #? name=Jump to &hellip; <a href=\"https:\/\/www.pnfsoftware.com\/blog\/jeb-plugin-how-to-jump-to-an-activity\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">JEB Plugin How-To: Jump to an Activity<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-182","post","type-post","status-publish","format-standard","hentry","category-api-jeb1"],"_links":{"self":[{"href":"https:\/\/www.pnfsoftware.com\/blog\/wp-json\/wp\/v2\/posts\/182","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pnfsoftware.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pnfsoftware.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pnfsoftware.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pnfsoftware.com\/blog\/wp-json\/wp\/v2\/comments?post=182"}],"version-history":[{"count":0,"href":"https:\/\/www.pnfsoftware.com\/blog\/wp-json\/wp\/v2\/posts\/182\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.pnfsoftware.com\/blog\/wp-json\/wp\/v2\/media?parent=182"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pnfsoftware.com\/blog\/wp-json\/wp\/v2\/categories?post=182"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pnfsoftware.com\/blog\/wp-json\/wp\/v2\/tags?post=182"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}