Hello,
I'm new to B4A and currently use the trial for 2 weeks (and like it so far.)
Now here my problem :
I have created some lables programmatically and now I try to use the sender object in Activity_touch.
I create the lables like this:
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
I was able to use sender in the label's click event.
So I know which label has trigegd a click event.
Now I need to determine which label has triggered the touch event.
But I get the following errors :
MyLabel not initialized / ActivityWrapper cannot be cast to android.widget.textview
This is what I've tried:
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
Heinz
			
			I'm new to B4A and currently use the trial for 2 weeks (and like it so far.)
Now here my problem :
I have created some lables programmatically and now I try to use the sender object in Activity_touch.
I create the lables like this:
			
				B4X:
			
		
		
		For iLine = 0 To 2
      For iColumn = 0 To 2
      
         iCounter = iCounter + 1
         Dim b As Label  
         'b.Initialize("label")    'All buttons share the same event sub
         b.Initialize("Activity")  'Without this the touch_event didnt work at all...
         b.TextSize = 30
         b.Text = iCounter
            
         Activity.AddView(b,offsetX + iColumn * (width + 10dip), offsetY + iLine * (width + 10dip), width, width)
            
      Next
NextSo I know which label has trigegd a click event.
Now I need to determine which label has triggered the touch event.
But I get the following errors :
MyLabel not initialized / ActivityWrapper cannot be cast to android.widget.textview
This is what I've tried:
			
				B4X:
			
		
		
		Sub Activity_Touch (Action As Int, x As Float, Y As Float)
Dim myLabel As Label
Select Action
   Case Activity.ACTION_DOWN 
            
      myLabel = Sender         <--"MyLabel not initialized" / "ActivityWrapper cannot be cast to android.widget.textview"
      myLabel.Text = "I've been touched"
      
   end select
   
end subHeinz
 
				 
 
		 
 
		 
 
		 
 
		 
 
		