Questions tagged «flutter-channel»

4
升级flutter后创建方法通道-无法解析方法getFlutterView()
我在Flutter应用程序中使用本机android方法使用文档说 MethodChannel(flutterView, CHANNEL).setMethodCallHandler... 但是升级颤振后,该MethodChannel功能将不再需要,flutterView并且flutterView不再可用。 can not resolve method getFlutterView() 我认为应该有一个用于创建频道的新教程 相反,它需要一些BinaryMessenger我不知道该给些什么。 这是旧的代码,不再起作用: import io.flutter.app.FlutterActivity; import io.flutter.plugin.common.MethodCall; import io.flutter.plugin.common.MethodChannel; import io.flutter.plugin.common.MethodChannel.MethodCallHandler; import io.flutter.plugin.common.MethodChannel.Result; public class MainActivity extends FlutterActivity { private static final String CHANNEL = "samples.flutter.dev/battery"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); GeneratedPluginRegistrant.registerWith(this); new MethodChannel(getFlutterView(), CHANNEL).setMethodCallHandler( new MethodCallHandler() { @Override …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.