Unverified Commit c863c018 authored by Jia Hao's avatar Jia Hao Committed by GitHub

Use FLUTTER_VIEW_ID to find the Flutter view (#87324)

parent a69b3ca5
......@@ -10,7 +10,6 @@ import android.os.Build;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import java.util.HashMap;
......@@ -32,9 +31,7 @@ public class MainActivity extends FlutterActivity implements MethodChannel.Metho
private MethodChannel.Result permissionResult;
private View getFlutterView() {
// TODO(egarciad): Set an unique ID in FlutterView, so it's easier to look it up.
ViewGroup root = (ViewGroup)findViewById(android.R.id.content);
return ((ViewGroup)root.getChildAt(0)).getChildAt(0);
return findViewById(FLUTTER_VIEW_ID);
}
@Override
......
......@@ -36,9 +36,7 @@ public class MainActivity extends FlutterActivity implements MethodChannel.Metho
private MethodChannel.Result permissionResult;
private View getFlutterView() {
// TODO(egarciad): Set an unique ID in FlutterView, so it's easier to look it up.
ViewGroup root = (ViewGroup)findViewById(android.R.id.content);
return ((ViewGroup)root.getChildAt(0)).getChildAt(0);
return findViewById(FLUTTER_VIEW_ID);
}
private String getViewName(View view) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment