Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 5    Views: 80

Rishav
Code is Art
Profile
Posts: 153
Reg: Jan 26, 2012
Dubai
8,780
10/14/13 01:31 AM (12 years ago)

Manually call a screen from code?

I have a search box and a button and i want to call the menu with image screen to display the results. I have the placed the following code in the onclick function the search button but the result is not as desired. It show a class not found error though i can see WB_screen_menuImage.java file in my project. Can anyone help me in solving this problem. Any help would be appreciated. JSONObject innerObject; BT_item obj; obj = new BT_item(); obj.setItemType("WB_screen_menuImage"); obj.setItemId("searchresult"); obj.setItemNickname("Search Results"); innerObject = new JSONObject(); innerObject.put("dataURL","http://example.com/?q="+search); innerObject.put("navBarRightButtonType","home"); innerObject.put("navBarRightButtonTapLoadScreenNickname","Login"); innerObject.put("navBarRightButtonTapLoadScreenItemId","13CF88E33D8D480FD77E961"); innerObject.put("contextMenuNickname","More"); innerObject.put("contextMenuItemId","4170FCE4521CB5AB84D7F0F"); innerObject.put("listTitleFontColor","#000000"); obj.setJsonObject(innerObject); loadScreenObject(null, obj);
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
10/14/13 02:21 AM (12 years ago)
If you can see it, then it's there. If it's there, and the code is telling you 'class not found', then it sounds like the 'code' can't see it... throw in something like BT_debugger.showIt(activityName + ":itemType: " + obj.itemType); after setting a few of the parameters and see if it returns the same value you think it should have. The output should end up in your logCat at the bottom of your screen in Eclipse Cheers! -- Smug and I'm just asking because I don't know any better... but 'loadScreenObject(null,obj) seems odd; it's looking for the parent activity, and you're feeding it a null value. does that work?
 
Rishav
Code is Art
Profile
Posts: 153
Reg: Jan 26, 2012
Dubai
8,780
like
10/14/13 10:16 AM (12 years ago)
Thanks for the reply.. I figured it out now.. Earlier i was setting the itemType correctly but i ignored to mention the itemType again in innerobject which caused the issue.. I figured it out by checking the initPluginWithScreenData method in BT_application.
 
Dusko
Veteran developer
Profile
Posts: 998
Reg: Oct 13, 2012
Beograd
22,680
like
10/14/13 10:18 AM (12 years ago)
Could you please post the correct solution now, so that we all can learn from you?
 
Rishav
Code is Art
Profile
Posts: 153
Reg: Jan 26, 2012
Dubai
8,780
like
10/14/13 10:19 AM (12 years ago)
So for others to load another screen with codes you all can use the following code JSONObject innerObject; BT_item obj; obj = new BT_item(); obj.setItemType("WB_screen_menuImage"); obj.setItemId("searchresult"); obj.setItemNickname("Search Results"); innerObject = new JSONObject(); innerObject.put("dataURL","http://example.com/"); innerObject.put("itemType","WB_screen_menuImage"); innerObject.put("itemNickname","Search Results"); innerObject.put("listTitleFontColor","#000000"); obj.setJsonObject(innerObject); loadScreenObject(null, obj);
 
Dusko
Veteran developer
Profile
Posts: 998
Reg: Oct 13, 2012
Beograd
22,680
like
10/14/13 10:22 AM (12 years ago)
That was quick! Thank you very much! I shall try this out -- I needed it for exactly the same reason as you did -- to show search results as a menu.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.