如何将静态短信息更改为动态

时间:2015-04-27 18:42:32

标签: android smsmanager

我创建了一个应用程序,可以根据特定情况自动发送短信。这是我的代码:

if(isNumberExist)//+923137737497
{
    //---display the new SMS message---
    hour = calendar.get(Calendar.HOUR_OF_DAY);
    min  = calendar.get(Calendar.MINUTE);
    date = String.format("%d/%d/%d",calendar.get(Calendar.DAY_OF_MONTH),calendar.get(Calendar.MONTH),calendar.get(Calendar.YEAR) );
    smsTime = String.format("%d:%d", hour,min);
    String[] numbers ;//= {"15555215558","15555215554"};
    db = database.getReadableDatabase();
    numbers= database.getNumbers(db, body);
    boolean loc = database.getSmsLocation(db, body);        
    db.close();

    if(loc)
    {       
        calendar.add(Calendar.MINUTE, 30);
        String time = calendar.get(Calendar.HOUR_OF_DAY)+ ":" + calendar.get(Calendar.MINUTE);

        //This is what I want to change. I mean I want that user can set a custom message instead of BUS TRAVELLING TIME IS xxxxx.
        String message = "Bus Travelling time is ";
        db = database.getWritableDatabase();
        for(int i=0; i<numbers.length; i++)
        {
            database.insert_sms_data(numbers[i],message,date,smsTime, db);
            sender.sendSMS1(numbers[i],message + time);

            //Toast.makeText(context, "SMS Sent to "+numbers[i], Toast.LENGTH_LONG).show();
        }

        /* code... */   
    }

    /* code... */   
}

如评论中所述:我希望该用户可以设置自定义消息,而不是BUS TRAVELING TIME是xxxxx。

0 个答案:

没有答案