Android Question send SMS from all values on a listview..

john1014

Member
anyone can help.me?.. i have a singleline2 listview on my design and a return value of phone numbers. My problem is , how do i create a loop that will send a SMS from the beginning position of my listview up to the last position with just one click of a button.. help me please..
 

udg

Expert
Licensed User
Longtime User
Hi, assuming you passed phone numbers as strings while adding items to the ListView (e.g. LV.AddSingleLine2("My friend Joe", "+41 77 1234567"), you could do something like
B4X:
private sub button1_click
dim pn as string
for i = 0 to LV.Size-1  'iterate on each item fro the list view
  pn = LV.GetItem(i)   'gets the phone number of item "i"
  SendSMS(pn)         'your sub to send SMSes
next
end sub
Note: untested code, just written here to give you an hint on how to proceed.
Note2: if SendSMS is event-driven (i.e. it gives feedback through a "jobdone" event for each SMS sent), then you should send just the first SMS from the button click and select the next one in the feedback event until no more numbers are to be processed.
 
Last edited:
Upvote 0
Top