Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 16    Views: 61

Bertrand
Apple Fan
Profile
Posts: 163
Reg: Dec 26, 2012
saint-quentin f...
4,680
02/04/14 08:08 AM (11 years ago)

BT_blank_screen Button (Android)

Hi, I am currently working on an android application with buzztouch and I need that on a Blank Screen I have a button with an action but I do not find how to perform this action. I tried several things but either the file contains errors or the plugin does not compile :/ Thanks
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
02/04/14 09:30 AM (11 years ago)
From your description, I would suggest you try the menu with buttons plugin, with a single menu item as your button. Not sure that hits the mark, but if you give us a description of what you tried and if there is a specific question you'd like answering, we'll do our best to help. Regards, Alan
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
02/04/14 12:26 PM (11 years ago)
Not sure what you're wanting the button click to do, but here's a real simple implementation. Just copy the .java file into your src/com.packagename folder (be sure to change the package name at the top of the .java file). And copy the .xml file into your res/layout folder. This is a really simple screen that has nothing but a button in the center. Clicking it will output a line to the logcat console saying "button clicked". .java file: https://www.dropbox.com/s/daoibyuy2p8u8e6/CR_actionButton.java .xml file: https://www.dropbox.com/s/jtc0w0ubhn0jgpm/actionbutton.xml
 
Bertrand
Apple Fan
Profile
Posts: 163
Reg: Dec 26, 2012
saint-quentin f...
4,680
like
02/05/14 01:44 AM (11 years ago)
@AlanMac : I try to incorporate metaio with buzztouch and I want metaio launches when I press a button on a blank screen. @chris1 : Thank you, I had a little difficulty managed to find just loan the same code as you :). But now I have a problem with the Intent object, when I put my view starting with my view of parameter arrived. Eclipse gives me an error on that line. Intent intent = new Intent(BT_screen_blank.this, MetaioARView.class); startService(intent);
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
02/05/14 02:23 AM (11 years ago)
Aahh, OK, clearly a bit more complicated than I originally thought. You might try posting on the forum ask if anyone has worked with metio? However, I just searched the forum and nothing came up for metaio, nobody has reported on it as far as I can tell.
 
Bertrand
Apple Fan
Profile
Posts: 163
Reg: Dec 26, 2012
saint-quentin f...
4,680
like
02/05/14 02:35 AM (11 years ago)
At the moment I do not have much of a problem, it's just the passage of a view to another by an event where crashes public void onClick(View v) { BT_debugger.showIt("onClick"); Intent intent = new Intent(BT_screen_blank.this, MetaioCloudARViewTestActivity.class); startActivity(intent); } I have an error with Intent, eclipse just propose to remove parameters
 
Bertrand
Apple Fan
Profile
Posts: 163
Reg: Dec 26, 2012
saint-quentin f...
4,680
like
02/05/14 03:57 AM (11 years ago)
In fact when BT_screen_blank class inherits from the Activity class I have no error in the Intent, but I have other errors that are generated. When BT_screen_blank class inherits from class BT_fragment I have only one error in the Intent
 
LA
Aspiring developer
Profile
Posts: 3280
Reg: Aug 16, 2012
Jerseyville, IL
42,900
like
02/05/14 11:15 AM (11 years ago)
Did you import intent? If you move your cursor over it, it gives a few options. LA
 
Bertrand
Apple Fan
Profile
Posts: 163
Reg: Dec 26, 2012
saint-quentin f...
4,680
like
02/06/14 01:54 AM (11 years ago)
Yes, i have import the Intent and when i write this line : Intent intent = new Intent(BT_screen_blank.this, MetaioCloudARViewTestActivity.class); eclipse just propose to remove parameters. BT_screen_blank inherits BT_fragment class et no Activity class. When i write the same code line in class inherits Activity, the error disappears Is it possible to change the class inheritance without causing error in the plugin? I've tried changing the BT_fragment Activity in the plugin but will not launch
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
02/06/14 01:59 AM (11 years ago)
Try getActivity() instead
 
Bertrand
Apple Fan
Profile
Posts: 163
Reg: Dec 26, 2012
saint-quentin f...
4,680
like
02/06/14 03:31 AM (11 years ago)
I just used the method getActivity() in the class BT_screen_blank and here is the result: com.testandroid.BT_activity_host@414bb6b0
 
Bertrand
Apple Fan
Profile
Posts: 163
Reg: Dec 26, 2012
saint-quentin f...
4,680
like
02/06/14 03:46 AM (11 years ago)
I get an error at the line: Intent intent = new Intent(BT_screen_blank.this, MetaioCloudARViewTestActivity.class); because BT_screen_blank does not inherit from the Activity class. The Intent constuctor wants a parameter type Activity and as second parameter the destination class.
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
02/06/14 06:30 AM (11 years ago)
I meant like this: Intent intent = new Intent(getActivity(), MetaioCloudARViewTestActivity.class); May need to use this.getActivity() if that doesn't work
 
Bertrand
Apple Fan
Profile
Posts: 163
Reg: Dec 26, 2012
saint-quentin f...
4,680
like
02/06/14 08:07 AM (11 years ago)
I using your code chris (Intent intent = new Intent(getActivity(), MetaioCloudARViewTestActivity.class);), I have no error but I still have a little problem. When I click the button to access the other view, the application remains on the BT_screen_blank. Looks like it just refreshes the view
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
02/06/14 08:36 AM (11 years ago)
Do u ever start the activity? startActivity(intent);
 
Bertrand
Apple Fan
Profile
Posts: 163
Reg: Dec 26, 2012
saint-quentin f...
4,680
like
02/06/14 08:43 AM (11 years ago)
yes I put the following code in the onClick: Intent intent = new Intent(getActivity(), ShareViewActivity.class); startActivity(intent);
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
02/06/14 08:51 AM (11 years ago)
Not sure then. That's how to call the activity. But I've never used that Metaio
 

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.