How do I use this keyword in static methods in Java?
•
Java
Is there any way to use this keyword in static methods in Java? I want to display toast messages in static methods in my activity class What do I do? thank you.
Solution
You can create a static method with an input parameter, which is the class you need to use
For example:
public static void showMyTouch(MyActivity act,String message){ Toast.makeText(act,message,Toast.LENGTH_LONG).show(); }@H_419_18@
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码