我是 Google Books API的新手,我尝试了很多来自 Stackoverflow 和 Youtube 的教程。
我想从多个 API 中搜索 ISBN 的书籍,但我无法弄清楚如何做到这一点。我实施了条形码扫描仪,但我不知道如何将其与 Google Books API 或 Goodreads API
一起使用这是我获取 ISBN 的地方:
public class ScanFragment extends Fragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
new IntentIntegrator(this.getActivity());
IntentIntegrator integrator = IntentIntegrator.forSupportFragment(this);
// use forSupportFragment or forFragment method to use fragments instead of activity
integrator.setDesiredBarcodeFormats(IntentIntegrator.ONE_D_CODE_TYPES);
integrator.setPrompt(this.getString(R.string.scan_bar_code));
integrator.setResultDisplayDuration(0); // milliseconds to display result on screen after scan
integrator.setCameraId(0); // Use a specific camera of the device
integrator.initiateScan();
}
/**
* function handle scan result
* @param requestCode scanned code
* @param resultCode result of scanned code
* @param intent intent
*/
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
//retrieve scan result
IntentResult scanningResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
ScanResultReceiver parentActivity = (ScanResultReceiver) this.getActivity();
if (scanningResult != null) {
//we have a result
String codeContent = scanningResult.getContents();
String codeFormat = scanningResult.getFormatName();
// send received data
parentActivity.scanResultData(codeFormat, codeContent);
}else{
// send exception
String noResultErrorMsg = "No scan data received!";
parentActivity.scanResultData(new NoScanResultException(noResultErrorMsg));
}
}
}
就是这样,因为我不知道如何从多个品牌实施 API'S 。 请帮帮我!!