Android: How to regain focus of EditText when switching between Activities in ActivityGroup

StackOverflow https://stackoverflow.com/questions/10229126

سؤال

I have an Activity A in an ActivityGroup with an EditText widget. When switching to Activity B (within the same ActivityGroup) and using the back button to go back to Activity A again, i cannot bring up the software keyboard when tapping the EditText. How can I solve this? Seems to be a focus issue similar to this

How to make EditText regain focus?

هل كانت مفيدة؟

المحلول 2

Solved my problem by using the approach on this post: call onrestart/onresume when click on back button

This way the (child) activity's onResume() method is always called when switching between actitvities and my EditText works (brings up the software keyboard) as expected!

نصائح أخرى

add this in xml file in Edittext

android:focusable="true"

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top