android-intent

Android - matching a url pattern?

白昼怎懂夜的黑 提交于 2019-12-29 20:29:10
问题 I'd like one of my activities to pick up a particular url. The pattern is: http://www.example.com/abc123/foo/xyz789 The path components "abc123" and "xyz789" can be any sequence of alpha-numerics, length > 1. Doing this in my manifest: <activity> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="http" android:host="example.com"

Testing that button starts an Activity with Robolectric

删除回忆录丶 提交于 2019-12-29 18:44:12
问题 Hi I have the following code: @RunWith(Test9Runner.class) public class MainActivityTest { private MainActivity activity; private Button pressMeButton; @Before public void setUp() throws Exception { activity = new MainActivity(); activity.onCreate(null); pressMeButton = (Button) activity.findViewById(R.id.button1); } @Test public void shouldUpdateResultsWhenButtonIsClicked() throws Exception { pressMeButton.performClick(); ShadowActivity shadowActivity = shadowOf(activity); Intent intent =

How to open my Android app when rss link is opened in browser?

限于喜欢 提交于 2019-12-29 18:02:35
问题 I'm creating an rss aggregator for my Android phone. I'd like to be able to subscribe to an rss feed from the browser since most websites have a subscribe via rss button. How can I build an intent filter to receive those links? This question was similar and showed how to create an intent filter to handle browser links: Make a link in the Android browser start up my app? However, I don't know how to make it specific to rss feeds. As an attempt I tried this filter: <intent-filter> <action

How to open my Android app when rss link is opened in browser?

ぃ、小莉子 提交于 2019-12-29 18:02:05
问题 I'm creating an rss aggregator for my Android phone. I'd like to be able to subscribe to an rss feed from the browser since most websites have a subscribe via rss button. How can I build an intent filter to receive those links? This question was similar and showed how to create an intent filter to handle browser links: Make a link in the Android browser start up my app? However, I don't know how to make it specific to rss feeds. As an attempt I tried this filter: <intent-filter> <action

adb command for getting ip address assigned by operator

半城伤御伤魂 提交于 2019-12-29 10:27:11
问题 I need to fetch the IPaddress assigned by the operator after a successful 3G or LTE data call. $adb shell netcfg >> doesnt have the assigned IP address. I tried adb shell dumpsys and grep ip address, but in vain. Any help/pointers? 回答1: Try this command, it will help you to get ipaddress $ adb shell ifconfig tiwlan0 tiwlan0 is the name of the wi-fi network interface on the device. This is generic command for getting ipaddress, “adb shell netcfg” It will output like this usb0 DOWN 0.0.0.0 0.0

Passing ArrayList between activities

泄露秘密 提交于 2019-12-29 09:30:09
问题 I have an activity where I am adding objects into an ArrayList which implements the Parcelable interface. I then pass this list to another activity via a bundle however I get the following error when I try to print the size of the list in the new activity: java.lang.RuntimeException: Unable to resume activity {com.example.test/com.example.test.SectionsActivity}: java.lang.NullPointerException Here is the first activity where I add to list: @Override protected void onListItemClick(ListView l,

onclick button is not working in listview

不羁的心 提交于 2019-12-29 09:28:10
问题 My project contains listView(homelistView) that contains button(btnList) . When I click on button(btnList) it must go to another Activity. I tried a lot but I didn't find a good example. Please suggest me a good example regarding this. Below is my code: Here is my listview contains button. When on click of button it must go to other activity --------------------------------A-- text text button(btnList) B --------------------------------C--- text text BUTTON(btnList) D ------------------------

Error:Execution failed for task ':app:dexDebug'. > comcommand finished with non-zero exit value 2

心已入冬 提交于 2019-12-29 09:13:11
问题 In android studio I implement push notification. I downloaded a demo and import in android studio. There is no problem in source code but when I run this program it will show the problem: Error:Execution failed for task ':app:dexDebug'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_40\bin\java.exe'' finished with non-zero exit value 2 How can I solve it?Please help! 回答1: You need to know the root

Camera Intent result woes

无人久伴 提交于 2019-12-29 08:55:39
问题 I am attempting to launch the built-in camera to take a picture, a picture that will have a name specified by the activity launching the camera. (code below) When the camera returns, onActivityResult() goes straight to resultCode == Activity.RESULT_CANCELED . Any explanation for this and solutions would be greatly appreciated. The camera indeed does take the image, I can see it in my sdcard with a file viewer, but its name is the stock one from the camera. How can I get the name of this taken

How to open System Data Usage Activity in android?

北慕城南 提交于 2019-12-29 08:10:01
问题 Can anybody tell me how to open Data usage from android settings from my app? I do not now which Intent I should call. 回答1: It works well for using the below code in my project: Intent intent = new Intent(Intent.ACTION_MAIN); intent.setComponent(new ComponentName("com.android.settings", "com.android.settings.Settings$DataUsageSummaryActivity")); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); And you can see the package info from here: