override fun onResume() { super.onResume() itemname = view?.findViewById<TextView>(R.id.name) // Retrieve the Clover account if (mAccount == null) { mAccount = CloverAccount.getAccount(activity) if (mAccount == null) { return } } // Connect InventoryConnector connect() // Get Item InventoryAsyncTask().execute() } /* 3) Disconnect from the Clover Connectors when you aren’t using them to follow Android best practices and let the connection end naturally. */ override fun onDestroy() { super.onDestroy() disconnect() } private fun connect() { disconnect() if (mAccount != null) { mInventoryConnector = InventoryConnector(activity, mAccount, null) mInventoryConnector!!.connect() } } private fun disconnect() { if (mInventoryConnector != null) { mInventoryConnector!!.disconnect() mInventoryConnector = null } } /* 4) Use async tasks when working with Clover Connector classes to minimize work on the main UI thread while fetching or changing data. See https://docs.clover.com/clover-platform/docs/clover-development- basics-android#section-async-tasks-and-executors. */ private inner class InventoryAsyncTask : AsyncTask<Void?, Void?, Item?>() { override fun doInBackground(vararg params: Void?): Item? { try { //Get inventory item Log.d("tag", "text ${ mInventoryConnector!!.itemsWithCategories}") return mInventoryConnector!!.getItems().get(0) // mInventoryConnector!!.getItems().get(0) } catch (e: RemoteException) { e.printStackTrace() } catch (e: ClientException) { e.printStackTrace() } catch (e: ServiceException) { e.printStackTrace() } catch (e: BindingException) { e.printStackTrace() } return null } /* 5) Set the TextView to display the item’s name. For other methods that Item objects have, see https://clover.github.io/clover-android-sdk/com/clover/sdk/v3/inventory /Item.html */ override fun onPostExecute(item: Item?) { if (item != null) { itemname!!.setText(item.toString()) var name = arrayOf(item?.name) Log.d("tag", "text ${ Arrays.toString(name)}") } } }
can you guide me how to fetch the categories from inventory i m able to fetch the item from inventory but not able to fetch the categories