'How to send hidden data with intent to adapt in listview and getting the data according to the position of the list from the listview intent?

I am developing an app that is retrieving data from a web page. It is retrieving certain link data and the link href or address.

Now I am retrieving the link data and opening a new intent, sending an arraylist with it by putExtra. And in the new intent, I am displaying the data in a listview.

Here is the code that retrieves data and makes the arraylist:

htmlDocument = Jsoup.connect(htmlPageUrl).get();
htmlContentInStringFormat = htmlDocument.select("table.c tbody > tr > td:nth-child(3) > a");
for (Element eachItem:htmlContentInStringFormat){
    String bookList = eachItem.text().substring(0, 30);
    bookListArray.add(bookList);
}

New intent to adapt and show the list view:

Intent searchData = getIntent();
ArrayList<String> searchQuery = (ArrayList<String>)searchData.getStringArrayListExtra(MainActivity.SEARCH_DATA);


ArrayAdapter<String> bookListArrayAdapter = new ArrayAdapter<String>(getApplicationContext(), android.R.layout.simple_list_item_1, searchQuery);
setListAdapter(bookListArrayAdapter);

Now, here I know how to retreive the data of link href. But I need to send the data of href with each list item in the array, but that will not displayed in the list. But when the list item will be clicked, according the list position or id, the app will open a new intent, opening the link in a webView or retrieve some new info.

Which steps do I have to take for that?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source