error: no suitable method found for makeText(<anonymous OnCompleteListener<AuthResult>>,String,int)
method Toast.makeText(Context,CharSequence,int) is not applicable
(argument mismatch; <anonymous OnCompleteListener<AuthResult>> cannot be converted to Context)
method Toast.makeText(Context,int,int) is not applicable
(argument mismatch; <anonymous OnCompleteListener<AuthResult>> cannot be converted to Context)
答案 0 :(得分:0)
makeText()
方法定义为:
public static Toast makeText(Context context, CharSequence text, int duration)
显然,您正在使用侦听器作为上下文。
改为使用:
Toast.makeText([ACTIVIY NAME].this, "Message...", Toast.LENGTH_SHORT).show();
如果您位于Activity
内,则可以使用getApplicationContext()
来获取上下文
Toast.makeText(getApplicationContext(), "Message...", Toast.LENGTH_SHORT).show();
如果您位于Fragment
内,则可以使用getActivity()
来获取上下文
Toast.makeText(getActivity(), "Message...", Toast.LENGTH_SHORT).show();