We know that we can add some action buttons to chrome custom tabs. For this we have to create pending intent and then it will be able to be added. Right now I have such action button at toolbar:
val icon = BitmapFactory.decodeResource(resources, android.R.drawable.ic_menu_share)
val intent = Intent(context, MessageWrite::class.java)
intent.putExtra("mail_type", 6)
intent.putExtra("theme", "Заявка для Вашей работы $jobTitle")
intent.putExtra("body", "")
intent.putExtra("kind", 6)
if (companyMail.isNotEmpty()) {
intent.putExtra("receiver_mail", companyMail)
}
intent.putExtra("job_lst_type", 4)
val pi = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT)
builder.setActionButton(icon, "Write to company", pi)
but I would like to make two things:
- Add item to menu, not to toolbar like icon.
- Call function when I press on this icon, not moving to another
activity. So, how I can do it because as I see I have to use pending intents for making it, but I don't know how to do it withpending intent.