startactivityforresult

startActivityForResult(…) immediately returns 0

最后都变了- 提交于 2020-03-06 09:10:22
问题 When I call startActivityForResult(new Intent(getActivity(), VkAuth.class), VK_ID); on Samsung (on HTC and Nexus everything works fine), onActivityResult with requestCode == VK_ID and result code 0 (Cancelled) is called before the VkAuth Activity is created. The parent Activity has android:launchMode="singleInstance" . startActivityForResult is called from a Fragment attached to the parent Activity. Log E/AuthenticationFragment: vkLogIn E/AuthenticationFragment: startActivityForResult 9101 E

Android Custom Keyboard with SpeechRecognizer

自闭症网瘾萝莉.ら 提交于 2020-01-24 18:49:06
问题 I have a fully functional custom android keyboard in which i have to add speech recognition. Here are the relevant parts of the implementation i have public class CustomInputMethodService extends InputMethodService implements <random stuff> { private SpeechRecognizer mSpeechRecognizer; private RecognitionListener mSpeechlistener; public void onCreate() { super.onCreate(); mSpeechRecognizer = SpeechRecognizer.createSpeechRecognizer(this); mSpeechlistener = new CustomRecognitionListener();

How to manage activity with startActivityForResult

无人久伴 提交于 2020-01-20 08:51:10
问题 I got a situation like this: Activity A --> B --> C --> D, when D finished, I have to refresh ActivityA to display what I input in ActivityB , ActivityC and ActivityD.Here is my code: ActivityA @OnClick(R.id.btn_one) public void toActivityB(){ Intent intent = new Intent(); intent.setClass(this, ActivityB.class); startActivityForResult(intent, 1); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data);