Solved

Android send data via web page URL

Posted on 2014-03-05
3
224 Views
Last Modified: 2014-10-23
Is there sample code that when a button is click the on click listener will raise an intent to launch an activity to to post data to a web page URL
0
Comment
Question by:GlobaLevel
3 Comments
 
LVL 2

Accepted Solution

by:
Computer Egghead earned 500 total points
ID: 40266189

1. Add a button in your layout file with:

android:onClick="onOpenWebBrowser"

Open in new window


2. Import the following packages:

import android.net.Uri;
import android.content.Intent;

Open in new window


3. Add the following code:

    //Opens a web page when a button is clicked
    public void onOpenWebBrowser(View v)
    {
    	Intent webPageIntent = new Intent(Intent.ACTION_VIEW);
    	webPageIntent.setData(Uri.parse("http://www.computeregghead.com"));

    	try { 
    	    startActivity(webPageIntent);
    	} catch (ActivityNotFoundException ex) { 
    	    // do something about the exception 
    	}
    }

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Want search/indexing app for Android 13 79
Android release identifiers 7 33
Adding a shortcut to my Samsung Tab E (Android tablet) 9 70
Protecting a SKY 4.0 (Android) devise 15 96
Introduction Everyone is using a smartphone these days. Contacts, messages, applications, documents, bookmarks, pictures, videos and other stuff which you created and are present only on your device come under the umbrella called “Personal Data”.…
You should read OS supplied guidelines before developing. I can't stress that enough. The guidelines will help you understand the reasons mobile app developers do what they do.  Apple is very particular when they review appstore submissions.
This video is in connection to the article "The case of a missing mobile phone (https://www.experts-exchange.com/articles/28474/The-Case-of-a-Missing-Mobile-Phone.html)". It will help one to understand clearly the steps to track a lost android phone.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now