Oh and I used this code, rather than the once off code to get it to show an
update once a second...

public class TelephonyTest extends Activity
{
    private static String TAG = "TelephonyTest";
    private static TelephonyManager mTelephonyManager;
    private Thread t = null;

    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        mTelephonyManager =
(TelephonyManager)getSystemService(TelephonyTest.TELEPHONY_SERVICE);

        t = new Thread(new Runnable()
        {
            public void run()
            {
                try
                {
                    while(true)
                    {
                        doLog();
                        Thread.sleep(1000);
                    }
                } catch (Exception e) {}
            }
        });
        t.start();
    }

    private void doLog()
    {
        ArrayList<NeighboringCellInfo> mNeighboringCellInfo;
        mNeighboringCellInfo = new ArrayList<NeighboringCellInfo>();
        mNeighboringCellInfo =
(ArrayList<NeighboringCellInfo>)mTelephonyManager.getNeighboringCellInfo();
        if(mNeighboringCellInfo.size() == 0)
            Log.i(TAG, "No Neighboring Cells detected.");
        for(int i = 0; i < mNeighboringCellInfo.size(); ++i)
        {
            Log.i(TAG,"mNeighboringCellInfo.get(i) - "+
                        mNeighboringCellInfo.get(i).toString());
        }
    }
}

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to