我怎样才能通过 findViewById作为参数?
我想要创建方法:
public void makeText() {
String random = randomize(); //example...
TextView textView = (TextView) findViewById(R.id.textView);
textView.setText(randomText);
}
Run Code Online (Sandbox Code Playgroud)
但是当然这个方法没有 function findViewById。方法makeText是外部Activity和Fragment类。