Android Question Out of designer code

Discussion in 'Android Questions' started by Enthousiastic, Jul 14, 2015.

  1. Enthousiastic

    Enthousiastic Active Member Licensed User

    Hello , i want to write some code out of designer.I have two questions

    a) I want a label with properties : orientation TOP_BOTOM , with two colors first RGB(236,204,34) and second RGB(245,99,99) , with corner radius =5 . What code shall i write after initialize the label ?

    b) I want five activities with a general code to have five different backgrounds , with five different .jpg files. In process globals i wrote :

    Type EnvKind (ENV_BLUE As String , ENV_RED As String , ENV_GREEN As String , ENV_YELLOW As String , ENV_BROWN As String ) ' ENV_BLUE has blue.jpg as background ....

    Dim env As EnvKind

    Now with select case i want to put the different .jpg something like

    Case select env ........ Activity.Background ...... ? => what shall i write ?

    Many thanks to all of you
    Enthousiastic !!!!!
  2. LucaMs

    LucaMs Expert Licensed User

    a) I think you should use: Label.Gravity and ColorDrawable

    b) you could use a Map:
    mapEnv.Put("Blue", bmpBlue)
    mapEnv.Put("Red", bmpRed)

    Activity.Background = mapEnv.Get(SelectedColorString)

    [P.S. better, use constants like ENV_BLU, ENV_RED... set to Int 0, 1, ... and:
    mapEnv.Put(ENV_BLU, bmpBlue)
    mapEnv.Put(ENV_RED, bmpRed)

    Activity.Background = mapEnv.Get(intSelectedColor)
    Last edited: Jul 14, 2015