using a string resource in a Toast

前端 未结 5 1581
不知归路
不知归路 2020-12-18 23:25

My code is:

public static void ToastMemoryShort (Context context) {
    CharSequence text = getString(R.string.toast_memoryshort); //error here
    Toast.mak         


        
5条回答
  •  春和景丽
    2020-12-19 00:05

    Just use this instead:

    makeText(Context context, int resId, int duration) Make a standard toast that just contains a text view with the text from a resource.

    From http://developer.android.com/reference/android/widget/Toast.html

提交回复
热议问题