Method of data transmission using intent developed by Android

This paper describes the method of data transmission using intent in Android. Share with you for your reference, as follows:

During Android development, many people are familiar with intent, which is a class used to share data among multiple views. This section mainly describes how to load the URL in the text into a new page and print it by clicking the text in listview. For convenience, I'll paste the code of the previous article "Android Development: how to parse HTML pages using jsoup", because the code has been slightly modified after the previous section:

The results are as follows:

Then what we need to do is when we click the item in the listview, the program will send the URL link below each topic to the new page for display:

The following is the method of using intent to transfer data when clicking the listview item:

In the sub page "topicdetails. Java", we can receive the passed values in the following ways:

Of course, don't forget to add the activity mapping (yellow background) in the androidmanifest.xml file:

In this way, when everything is ready, run the program, click the item of listview, and we successfully jump to the sub page:

Here are all the source codes:

Main page source code:

Sub page source code:

More readers interested in Android related content can view the special topics of this site: summary of Android debugging skills and solutions to common problems, introduction and advanced tutorial of Android development, summary of Android multimedia operation skills (audio, video, recording, etc.), summary of usage of Android basic components, summary of Android view skills Android layout skills summary and Android control usage summary

I hope this article will help you in Android programming.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>