Need Some General Help for Android Programming

Discussion in 'Android Questions' started by Movado, Feb 2, 2011.

  1. Movado

    Movado Member

    Hey Guys,

    I recently started developing applications for android and stumbled upon Basic4Android. I took a course a few years ago for visual basic and the code is similar and easy to learn. I have a few general questions though.

    1) How to you program a button to exit or quit the application? For example:
    Code:
    Sub Button1_Click
        
    'code that closes application
    End Sub
    2) How do i switch between multiple layouts. For example, i have layout1 open with the application and when a button is clicked, it switches to layout2.

    3) How do i set the background of a layout to a picture and does it need to be a specific format?

    I know they are really easy questions but your help is much appreciated, thanks!

    (Sorry for putting in wrong section!)
     
    Last edited: Feb 2, 2011
  2. James Moxham

    James Moxham Member Licensed User

    I'm still learning this too. In answer to 1, I think it is
    Code:
    activity.finish ' close the program
    I'm pretty sure 2 has been answered on this forum recently. Someone will hopefully chime in soon with the answers to 2 and 3.
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    First I recommend you to start with the tutorials listed here: Basic4android - Android programming with Gui designer
    2) You can use multiple activities or you can load the layout to a panel and add the panel to the activity. Then you can remove the panel. Create a new one and load the second layout to this panel.
    3) In the designer you should add an image (all popular types supported) to the Images List, then change the activity Drawable to BitmapDrawable and choose the image.
     
  4. Movado

    Movado Member

    Thanks i will try the code out to close the program. And thanks Erel for the info on added pictures, i figured out how to change between layouts as well. Do you know how i can, by pressing a button open another application installed on my phone, specifically when the button is pressed Google Maps opens up?
     
    Last edited: Feb 2, 2011
  5. mramos

    mramos Member Licensed User

    Movado

    Here is a test to run webview, if you load it in a panel and display it with an exit button (that flip visible true and false), you will have what you want.
     

    Attached Files:

  6. Erel

    Erel Administrator Staff Member Licensed User

    Off topic. @mramos have you tried to run the new version on your home computer? I expect it to work.
     
  7. Movado

    Movado Member

    Thanks, i changed it up a bit but it worked :p Is there any way i can call the button to open an application already installed on my phone though, the Google Maps App so it doesn't need to work through a webview?
     
  8. Erel

    Erel Administrator Staff Member Licensed User

    You will need to use the Phone library and create an Intent object that matches the application package name.
     
  9. Movado

    Movado Member

    Oh okay. I am using the trial atm so if i upgrade to full version i will be able to do this. Thanks
     
  10. mramos

    mramos Member Licensed User

    Should be able to do this on the trail I would think.

    In the far right pane there is tabs at the bottom, click libraries and you should see the one Erel mentions (Phone), just check it on.


    Erel, I think I have the new version at home, will check tonight. Hope it fixes it, I really like your compiler a lot. Can not do much at work Thanks
     
  11. Movado

    Movado Member

    Oh okay i thought the libraries function was disabled on the trial.
    Edit: Just tried, need full version
     
  12. James Moxham

    James Moxham Member Licensed User

    I'd recommend getting the full version. I'm a bit of a cheapskate buying stuff, particularly on the internet, but I also know a bargain when I see one, and Basic4Android is a bargain.

    How many languages are there where you can request something and the author implements it the next day? That has happened twice in the last week (thanks Erel!).

    I look at the price of an apple ipad and it is still a lot more than the cost of an Android plus Basic4Android.

    Just my 2c worth FWIW.
     
  13. Movado

    Movado Member

    Lol ya i know, i am planning on buying it in a few weeks after i get my work in order :p
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice