我试图通过我的代码向短号码发送短信:
sendSMS("5556", "Test");
private void sendSMS(String phoneNumber, String message) {
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(phoneNumber, null, message, null, null);
}
调用方法后,Android会显示下一个弹出窗口:
我如何知道用户是否点击了发送或取消?
答案 0 :(得分:0)
请参阅SmsManager API - 使用import java.util.Scanner;
public class main {
public static void main(String[] args) {
Scanner keyboard= new Scanner(System.in);
final int MAXPEOPLE=100;
instrumentalist [] instrumentalistArr;
instrumentalistArr=new instrumentalist[MAXPEOPLE];
char choice;
int index=0;
int instrumentalistCOUNT=0;
do {
instrumentalist ainstrumentalist = new instrumentalist();
ainstrumentalist.readin();
instrumentalistArr[index]=ainstrumentalist;
instrumentalistCOUNT++;
index++;
System.out.println("would you like to enter another data set yes or no");
choice=keyboard.next().charAt(0);
} while(choice!='n');
instrumentalist [] copyarray;
copyarray=new instrumentalist[instrumentalistArr.length];
for(int i=0; i<instrumentalistCOUNT; i++) {
copyarray[i]=instrumentalistArr[i];
}
for(int i=0; index<instrumentalistCOUNT; i++) {
System.out.println("musician"+" "+ copyarray[index].getmusicianname());
}
}
}
参数确定结果。