How do I use this keyword in static methods in 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
分享
二维码
< <上一篇
下一篇>>