cancel
Showing results for 
Search instead for 
Did you mean: 

How to call two entities from one fragment using SAP BTP Android wizard code

dillibabubottu
Explorer
0 Kudos

Hi Experts,

I am using SAP BTP Android SDK, I am having a doubt please find the below scenario

I have one fragment as shown below , if i click on products it has to open products and if i click on customers it has to open the customers , both products and customers classes codes are generated from SAP BTP android wizard .Can any one please help me on this

Thanks ,

Delli

Accepted Solutions (0)

Answers (1)

Answers (1)

xuefengluo
Advisor
Advisor
0 Kudos

For your generated app, it should create a EntitySetListActivity, here you can find some codes which can satisfy your requirement, for example

...

listView.setOnItemClickListener listView@{ _, _, position, _ ->
val entitySetName = entitySetNameMap[adapter.getItem(position)!!]
val context = this@EntitySetListActivity
val intent: Intent = when (entitySetName) {
EntitySetName.Customers -> Intent(context, CustomersActivity::class.java)
...
EntitySetName.Products -> Intent(context, ProductsActivity::class.java)...
else -> return@listView
}
context.startActivity(intent)
}...

Actually you just invoke the below codes snips:

...

val context = this@EntitySetListActivity. // Replaced with your activity
val intent: Intent = Intent(context, CustomersActivity::class.java)

context.startActivity(intent)
...

in the OnClickListener of the button "Customers" should be enough.

dillibabubottu
Explorer
0 Kudos

Hi xuefengluo ,

Thanks for your reply, 

Actually i am looking to call two entities in the same class , for example I have to get some value from the typesets and that value I have to pass it another entity in the same class, can you guide me how to do the above one 

Thanks,

Delli