0

I am developing one application for that I made some changes in CallCard.java class of Phone application. You can find this class here <http://www.netmite.com/android/mydroid/packages/apps/Phone/src/com/android/phone/CallCard.java>. In the above class there are some cases. i.e BUSY, NUMBER_UNREACHABLE and POWER_OFF etc. In the case of POWER_OFF I called a method of a below class.

public class MyClass extends Activity{ 



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        System.out.println("**inside myclass");

    }

    public  void  powerOff(Context c){
        System.out.println("**inside powerOff");
        Intent call = new Intent(Intent.ACTION_DIAL,Uri.parse("tel:+5555")); 
        startActivity(call);
    }

}

This is my own class and added into source directory Phone application. The code is like this:

case POWER_OFF:
   resID = R.string.callFailed_powerOff;
   MyClass myClass = new MyClass();
   if(myClass != null){
       System.out.println("**not null");
        myClass.powerOff(getContext);
    }
   break;

The reason to do this is, I want to Call other number of same person when first-dialed number is switched_off(currentl hard-coded number). I think this is only one way to this.!! Finaly I started build the code but got some error. i.e 'Cannot find symbol'

Symbol: variable getContext
Location: com.android.phone.
    myClass.powerOff(getContext);
                     ^

Is my way correct? and why this error. plz help me

shiv1229
  • 357
  • 2
  • 6
  • 19

2 Answers2

1

Isn't getContext a method? IMO using getContext() should work. Or, according to this, you might want tweak it a bit more.

Community
  • 1
  • 1
Laur Ivan
  • 4,117
  • 3
  • 38
  • 62
0

You have to use getBaseContext() instead of getContext variable

nandeesh
  • 24,740
  • 6
  • 69
  • 79