I need this program running today it reads in a file of phone numbers
and it text everyone in the file. I am getting a error on the file
read. Can you please help me ASAP
package com.smith.johnathan.jssms;
//import android.telephony.SmsManager;
import android.telephony.gsm.SmsManager;
import android.util.Log;
import android.widget.Button;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import android.util.LogPrinter;
import java.io.*;
import android.app.Activity;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.widget.TextView;
import android.os.*;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;
public class JSSMS extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button button = (Button) findViewById(R.id.Button01);
button.setOnClickListener(new OnClickListener() {
public void
onClick(View v)
{
Toast.makeText(JSSMS.this, "Starting SMS", Toast.LENGTH_SHORT).show();
SmsManager sm = SmsManager.getDefault();
String
message = "TESTING JS-JSS";
String
number;
try {
//
open the file for reading
InputStream instream =
openFileInput(Environment.getExternalStorageDirectory().toString()
+ "/numbers.txt");
//
prepare the file for reading
InputStreamReader inputreader = new InputStreamReader(instream);
BufferedReader buffreader = new BufferedReader(inputreader);
while ((number = buffreader.readLine()) != null)
{
Toast.makeText(JSSMS.this, "Sending text to:" + number,
Toast.LENGTH_SHORT).show();
sm.sendTextMessage(number, null, message, null, null);
}
instream.close();
}
catch (java.io.FileNotFoundException e) {
Toast.makeText(JSSMS.this,e.toString(), Toast.LENGTH_SHORT).show();
} catch (Exception e)
{
Toast.makeText(JSSMS.this,e.toString(), Toast.LENGTH_SHORT).show();
}
Toast.makeText(JSSMS.this,
Environment.getExternalStorageDirectory().toString()
+ "/numbers.txt", Toast.LENGTH_SHORT).show();
}
});
}
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en