android - Toast is unable to draw -
i creating 1 broadcat receiver aplication. in getting following error
the method maketext(context, charsequence, int) in type toast not applicable arguments (myphonecall, string, int)
java code :
package com.example.myphonecall; import android.content.broadcastreceiver; import android.content.context; import android.content.intent; import android.os.bundle; import android.telephony.telephonymanager; import android.util.log; import android.widget.toast; public class myphonecall extends broadcastreceiver { @ override public void onreceive(context context, intent intent) { bundle extras = intent.getextras(); if (extras != null) { string state = extras.getstring(telephonymanager.extra_state); log.w("my_debug_tag", state); if (state.equals(telephonymanager.extra_state_ringing)) { string phonenumber = extras .getstring(telephonymanager.extra_incoming_number); //log.w("my_debug_tag", phonenumber); toast.maketext(this, "getting call " + phonenumber, toast.length_long).show(); } } } }
use
toast.maketext(context, "getting call "+phonenumber, toast.length_long).show();
Comments
Post a Comment