Reputation: 127
I have a little bit of a problem. I need in my first activity to link to an online webpage. I've done this using a WebView. Once my WebView displays the webpage in my activity, there will be a button in the respective online page that will have to link to the next application activity. How will I manage to identify that button (ID) and then make it link to the next activity, which is not a WebView?
I wonder how can this be done and if it has a certain name. It may be done using Php on that page. If some of you find something useful or even a solution to this problem, please help me, and I will surely reward your answer.
Thanks!
Upvotes: 3
Views: 201
Reputation: 46856
I don't think you need to use php to achieve this. In order to make it work you have to add a few things to your Activities intent filter in the manifest. Here is an example intent-filter entry:
<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="yourwebsite.com"
android:path="/ActivityName/" />
</intent-filter>
Then on your web page you can make a link like this:
<a href="http://yourwebsite.com/ActivityName/">Goto next Activity</a>
When you click the link it should give the users the choice to open it with your application. I would recommend instructing them to check the "Always preform this action with this app" checkbox so that they aren't presented a choice every time.
Note: that the ActivityName
in the path is not a requirement(it could be anything), but if you have multiple activities that could be getting launched this way using activity name seems like a logical choice to me.
This website contains another good example. And an example of how you can send data from the web page to the app.
Upvotes: 2