start-activity

Open a fragment of an activity from another activity

▼魔方 西西 提交于 2019-12-07 03:43:37
问题 Hi All I want to open the "Text-To-Speech output" fragment of Settings from my application. I think first I need to open the settings activity and then its fragment. I tried setting the ComponentName but it was unable to locate the activity. Should I use FragmentManager ; I couldn't find anything specific to my needs. Can somebody give me some link which might explain it well. 回答1: You can use the following: Intent ttsSettings = new Intent("com.android.settings.TTS_SETTINGS"); ttsSettings

Open a fragment of an activity from another activity

99封情书 提交于 2019-12-05 06:42:13
Hi All I want to open the "Text-To-Speech output" fragment of Settings from my application. I think first I need to open the settings activity and then its fragment. I tried setting the ComponentName but it was unable to locate the activity. Should I use FragmentManager ; I couldn't find anything specific to my needs. Can somebody give me some link which might explain it well. You can use the following: Intent ttsSettings = new Intent("com.android.settings.TTS_SETTINGS"); ttsSettings.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(ttsSettings); Amit You are right, First You need to

Wrong requestCode returned onActivityResult from another Activity

百般思念 提交于 2019-12-03 22:18:43
I have an Activity that calls another Activity , that calls some other Activities . I send to the last Activity to get a result, and then i send back the result to the fist Activity . The flow is somthing like A -> B -> C -> D -> C -> B -> A With the flow from A to D is made of startActivityForResult and the flow from D to A is made of onActivityResult . From D to B the requestCode is always the same (the one I decided), but from B to A it suddenly change from my value to a random value (in this particular case 196614). This is the code I use to call the activity B from activity A :

Android Custom Launcher startActivity() blocks BOOT_COMPLETED intent

匆匆过客 提交于 2019-12-03 13:41:03
问题 I am currently working on a custom ROM (based on CyanogenMod 11.0), which aims to implement a custom "Kiosk Mode". To do this, I have three components in one application (with system privileges): The service, which handles modifications to the status/navigationbar and disables the power key. The receiver, which only starts the service after the BOOT_COMPLETED signal is received. The HomeIntentWrapper works as the launcher, and only starts one custom activity. The problem I am currently facing

Android - AssertionFailedError on startActivity method in ActivityUnitTestCase test class

筅森魡賤 提交于 2019-12-03 11:06:41
问题 I am trying to test an activity in a module. I am just trying to start this activity in the test method, but I always have a AssertionFailedError . I searched the web for this issue but could not find any solution. Any help is appreciated. This is my test class: public class ContactActivityTest extends ActivityUnitTestCase<ContactActivity> { public ContactActivityTest() { super(ContactActivity.class); } @Override public void setUp() throws Exception { super.setUp(); } public void

Android Custom Launcher startActivity() blocks BOOT_COMPLETED intent

ⅰ亾dé卋堺 提交于 2019-12-03 04:37:18
I am currently working on a custom ROM (based on CyanogenMod 11.0), which aims to implement a custom "Kiosk Mode". To do this, I have three components in one application (with system privileges): The service, which handles modifications to the status/navigationbar and disables the power key. The receiver, which only starts the service after the BOOT_COMPLETED signal is received. The HomeIntentWrapper works as the launcher, and only starts one custom activity. The problem I am currently facing is that the startActivity(...) command in the HomeIntentWrapper somehow blocks the system from booting

Android - AssertionFailedError on startActivity method in ActivityUnitTestCase test class

微笑、不失礼 提交于 2019-12-03 01:29:19
I am trying to test an activity in a module. I am just trying to start this activity in the test method, but I always have a AssertionFailedError . I searched the web for this issue but could not find any solution. Any help is appreciated. This is my test class: public class ContactActivityTest extends ActivityUnitTestCase<ContactActivity> { public ContactActivityTest() { super(ContactActivity.class); } @Override public void setUp() throws Exception { super.setUp(); } public void testWebViewHasNotSetBuiltInZoomControls() throws Exception { Intent intent = new Intent(getInstrumentation()

Android startActivityForResult, setResult, onActivityResult not called

有些话、适合烂在心里 提交于 2019-12-02 13:57:42
问题 I started a phone call Activity requesting for result: Intent intentcall = new Intent(); intentcall.setAction(Intent.ACTION_CALL); intentcall.setData(Uri.parse("tel:" + phoneNumber)); this.startActivityForResult(intentcall, REQUEST_SLIPDROP_ICON_OFF); And then set the result in phone call listener like this: private class MyPhoneStateListener extends PhoneStateListener{ public void onCallStateChanged(int state, String incomingNumber) { super.onCallStateChanged(state, incomingNumber); switch

Android startActivityForResult, setResult, onActivityResult not called

女生的网名这么多〃 提交于 2019-12-02 06:34:25
I started a phone call Activity requesting for result: Intent intentcall = new Intent(); intentcall.setAction(Intent.ACTION_CALL); intentcall.setData(Uri.parse("tel:" + phoneNumber)); this.startActivityForResult(intentcall, REQUEST_SLIPDROP_ICON_OFF); And then set the result in phone call listener like this: private class MyPhoneStateListener extends PhoneStateListener{ public void onCallStateChanged(int state, String incomingNumber) { super.onCallStateChanged(state, incomingNumber); switch (state) { case TelephonyManager.CALL_STATE_IDLE: setResult(Activity.RESULT_OK); break; Finally I want to

onSaveInstanceState is not getting called

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-01 09:18:33
I have an activity which starts various activities for result codes and on getting results in onActivityResult method it starts appropriate activity based on result code. onSaveInstanceState is not getting called in Activity which started for result. For example Navigation Activity starts Activity A as : Intent intent = new Intent(this, A.class); startActivityForResult(intent, Constants.REQUEST_CODE); Then A finishes by setting result code so App will redirect to Navigation activity again and onActivityResult method will called. So my question is: Why Activity A's onSaveInstanceState is not