有一个静态方法:
public static void mCount(String str){
}
您需要从中调用非静态方法并传递 str 参数:
public void setCredits(String str) {
txtView.setText(str);
}
如何更容易实施?
有一个静态方法:
public static void mCount(String str){
}
您需要从中调用非静态方法并传递 str 参数:
public void setCredits(String str) {
txtView.setText(str);
}
如何更容易实施?
将对象(需要在其上调用非静态方法)传递给您的静态方法并调用您想要的任何内容:
我通过创建被调用类的对象并将其设为静态来解决了这个问题。也许它是一个拐杖,但它有效)