everybody. Recently, I get a trial license key for SciChart Android v2x. I read many times tutorial to set license(https://www.scichart.com/licensing-scichart-android/) but cannot activate my license. Because there not written in which file should write the licence code. So I tried to write it in my MainActivity.java file of my application as shown below
package com.example.my5;
import android.os.Bundle;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
...
import com.scichart.charting.visuals.SciChartSurface;
import com.scichart.charting.visuals.axes.IAxis;
...
public class MainActivity extends AppCompatActivity {
private AppBarConfiguration mAppBarConfiguration;
String license = ("<LicenseContract>\n" +
" <Customer>nnuni@mail.ru</Customer>\n" +
" <OrderId>Trial</OrderId>\n" +
" <LicenseCount>1</LicenseCount>\n" +
" <IsTrialLicense>true</IsTrialLicense>\n" +
" <SupportExpires>12/31/2019 00:00:00</SupportExpires>\n" +
" <ProductCode>SC-ANDROID-2D-ENTERPRISE-SRC</ProductCode>\n" +
" <KeyCode>28a24cba44.........8a6c</KeyCode>\n" +
"</LicenseContract>");
// Use Static method SciChartSurface.setRuntimeLicenseKey()
SciChartSurface.setRuntimeLicenseKey(license);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
DrawerLayout drawer = findViewById(R.id.drawer_layout);
NavigationView navigationView = findViewById(R.id.nav_view);
// Passing each menu ID as a set of Ids because each
// menu should be considered as top level destinations.
mAppBarConfiguration = new AppBarConfiguration.Builder(
R.id.nav_home, R.id.nav_gallery, R.id.nav_slideshow,
R.id.nav_tools, R.id.nav_share, R.id.nav_send)
.setDrawerLayout(drawer)
.build();
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
NavigationUI.setupActionBarWithNavController(this, navController, mAppBarConfiguration);
NavigationUI.setupWithNavController(navigationView, navController);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onSupportNavigateUp() {
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
return NavigationUI.navigateUp(navController, mAppBarConfiguration)
|| super.onSupportNavigateUp();
}
}
But it gives me error:"Cannot resolve symbol".Any help please. I'm new in android studio. thanks in advance
The code and usage of the license is correct. Send the license key to Scichart support and they can check if it is valid or corrupted. They will also be able to advise better on issues like this.