Initialize Dynamsoft Camera View

In order to use functions of Dynamsoft Camera SDK Android Edition, you need to initiate dcsView before using its methods.

1. Add the DcsView object in the file activity_main.xml.


        <com.dynamsoft.camerasdk.view.DcsView
            android:id="@+id/dcsview_id"
            android:layout_height="match_parent"
            android:layout_width="match_parent"
            android:layout_above="@+id/tv_show_id"
            android:layout_below="@+id/tv_title_id"
            />

2. Add the following code in the file MainActivity.java.

  protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        try {
            DcsView.setLicense(getApplicationContext(),"your license number");
        } catch (DcsValueNotValidException e) {
            e.printStackTrace();
        }       
        dcsView = findViewById(R.id.dcsview_id);
}

How to set current view

The default current view is DVE_IMAGEGALLERYVIEW. You can call setCurrentView() to set it to the other view.

dcsView.setCurrentView(DcsView.DVE_VIDEOVIEW); 

Check related functions here.

Is this page helpful?

Leave a Reply

Your email address will not be published.