findViewById inside a Static Method
问题 I have this static method: public static void displayLevelUp(int level, Context context) { LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View layout = inflater.inflate(R.layout.custom_level_coast, (ViewGroup) findViewById(R.id.toast_layout_root)); // this row TextView text = (TextView) layout.findViewById(R.id.toastText); text.setText("This is a custom toast"); Toast toast = new Toast(context); toast.setGravity(Gravity.CENTER_VERTICAL,