Flutter application with native android view hosting
1. SDK Version: 5.0.6
2. Development Environment: Flutter / Android SDK
3. Tracker/Scanner: Image Tracker
4. License Type(Free / Pro-One Time Fee / Pro-Subscription / Enterprise): Free
Hi, I work on a investigation on how we can use the Image Tracker feature in a flutter application. I tried to use the sample. As I see the native sample application uses a activity for displaying the content. However in a flutter application we can embed native Android View classes only, how is it possible to reuse the sample ImageTrackerActivity class in a Android View? (Iam not an android java expert). Can someone guide me? Here is the official flutter documentation about hosting native android views in flutter applications: docs (click here)
Here is a example of showing a native textview in a flutter application:
package dev.flutter.example;
import android.content.Context;
import android.graphics.Color;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import io.flutter.plugin.platform.PlatformView;
import java.util.Map;
class NativeView implements PlatformView {
@NonNull private final TextView textView;
NativeView(@NonNull Context context, int id, @Nullable Map<String, Object> creationParams) {
textView = new TextView(context);
textView.setTextSize(72);
textView.setBackgroundColor(Color.rgb(255, 255, 255));
textView.setText("Rendered on a native Android view (id: " + id + ")");
}
@NonNull
@Override
public View getView() {
return textView; // This is where we have to return the Android View
}
@Override
public void dispose() {}
}
Thank you for your interest in MAXST AR SDK.
Sorry, MAXST AR SDK doesn't support Flutter.
Also, The forum provides answers to the usage and bugs of MAXST AR SDK.
If you have related the MAXST AR SDK questions, feel free to ask.
Best regards,
Francisco
MAXST Support Team