Try String str =sum();
Android Apps Developer On Jul 15, 2009 11:34 AM, "desmo84" <[email protected]> wrote: Ok, I'm still new to using java and j2me all together, although I understand enough to make basic programs and understand what I think about returning methods. I'm having trouble with the code below, for now all i want my code to do is pull up the MSISDN "telephone number" that a mobile device has. Everytime i run the emulator I get an error that the app has stopped unexpectedly and to try again. I've modified the helloworld demo a little bit and just trying to get the tn to show up. please tell me what i've done wrong and can someone also send me an article about using the android api's please. package com.general.AntiClep; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; import android.telephony.TelephonyManager; import android.content.Context; public class AntiClep extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { String str = null; sum(); super.onCreate(savedInstanceState); TextView tv = new TextView(this); tv.setText(str); setContentView(tv); } public String sum(){ TelephonyManager tm = (TelephonyManager)getSystemService (Context.TELEPHONY_SERVICE); String result = tm.getLine1Number(); return result; } } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" 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-beginners?hl=en -~----------~----~----~----~------~----~------~--~---

