one imageview 10 image.jpg

fifiddu70

Well-Known Member
Licensed User
Longtime User
I have an application consisting of 10 buttons, 10 images uploaded jpg files into the folder and a ImageView, I wish that when I press for example button 3 would see the image 3.jpg retreat or if the button 6 I want to display the image 6.jpg, how do I?
 
D

Deleted member 103

Guest
Ciao fifiddu70,

I have an application consisting of 10 buttons, 10 images uploaded jpg files into the folder and a ImageView, I wish that when I press for example button 3 would see the image 3.jpg retreat or if the button 6 I want to display the image 6.jpg, how do I?
più o meno così:
B4X:
  btn1.tag="image 1.jpg"
  btn2.tag="image 2.jpg"
  btn3.tag="image 3.jpg"

Sub btn_Click
  Dim btn As Button
  btn=Sender

  ImageView.Bitmap=LoadBitmap(File.DirAssets,btn.tag)
End Sub
 
Upvote 0

fifiddu70

Well-Known Member
Licensed User
Longtime User
filippo e se vorrei farlo all'arrivo di un messaggio?

B4X:
Sub SI_MessageReceived (From As String, Body As String) As Boolean
    ToastMessageShow(From, True)
   txtTesto.Text = Body
   TTS1.Speak (txtTesto.Text,True)
   txtNumber.Text = From
   
      If From = c.PhoneNumber Then
      txtName.Text = c.DisplayName
      End If
      if txttesto.text = "sorriso" then
                img2.Bitmap = LoadBitmap (File.DirAssets,"allegro.jpg")
                end if
    Return True
End Sub
vorrei che all'arrivo di una parola specifica in un sms, da una imageview vorrei visualizzare l'immagine corrispondente.non voglio creare 10 imageview per 10 immagini jpg. spero di essere chiaro :)
 
Upvote 0
Top