Convert Arraylist to a list of items to share through Whatsapp












-2















i'm developing an App which has an Arraylist with the name of the product and its quantity. Now i want to make an Intent to share this information like a list through the WhatsApp and e-mail, example:



Product: product1 Quantity: 2



Product: product2 Quantity: 5



Product: product3 Quantity: 1



Product: product4 Quantity: 7



or



Product: product1



Quantity: 2



Product: product2



Quantity: 5



Product: product3



Quantity: 1



Product: product4



Quantity: 7



It must send all the information at once like a list.










share|improve this question




















  • 1





    meta.stackoverflow.com/questions/284236/…

    – Iłya Bursov
    Nov 15 '18 at 17:07
















-2















i'm developing an App which has an Arraylist with the name of the product and its quantity. Now i want to make an Intent to share this information like a list through the WhatsApp and e-mail, example:



Product: product1 Quantity: 2



Product: product2 Quantity: 5



Product: product3 Quantity: 1



Product: product4 Quantity: 7



or



Product: product1



Quantity: 2



Product: product2



Quantity: 5



Product: product3



Quantity: 1



Product: product4



Quantity: 7



It must send all the information at once like a list.










share|improve this question




















  • 1





    meta.stackoverflow.com/questions/284236/…

    – Iłya Bursov
    Nov 15 '18 at 17:07














-2












-2








-2








i'm developing an App which has an Arraylist with the name of the product and its quantity. Now i want to make an Intent to share this information like a list through the WhatsApp and e-mail, example:



Product: product1 Quantity: 2



Product: product2 Quantity: 5



Product: product3 Quantity: 1



Product: product4 Quantity: 7



or



Product: product1



Quantity: 2



Product: product2



Quantity: 5



Product: product3



Quantity: 1



Product: product4



Quantity: 7



It must send all the information at once like a list.










share|improve this question
















i'm developing an App which has an Arraylist with the name of the product and its quantity. Now i want to make an Intent to share this information like a list through the WhatsApp and e-mail, example:



Product: product1 Quantity: 2



Product: product2 Quantity: 5



Product: product3 Quantity: 1



Product: product4 Quantity: 7



or



Product: product1



Quantity: 2



Product: product2



Quantity: 5



Product: product3



Quantity: 1



Product: product4



Quantity: 7



It must send all the information at once like a list.







java android arraylist






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 15 '18 at 23:47







Allan Jaqueira

















asked Nov 15 '18 at 17:06









Allan JaqueiraAllan Jaqueira

114




114








  • 1





    meta.stackoverflow.com/questions/284236/…

    – Iłya Bursov
    Nov 15 '18 at 17:07














  • 1





    meta.stackoverflow.com/questions/284236/…

    – Iłya Bursov
    Nov 15 '18 at 17:07








1




1





meta.stackoverflow.com/questions/284236/…

– Iłya Bursov
Nov 15 '18 at 17:07





meta.stackoverflow.com/questions/284236/…

– Iłya Bursov
Nov 15 '18 at 17:07












1 Answer
1






active

oldest

votes


















0














So you want to convert the ArrayList which contains strings as
" product1 , 5 "
"Product2 , 3" ...
To one String to share? If so you can use this code.



{
ArrayList<String> dataList = new ArrayList<>();
// Your arraylist that contains all the data
dataList.add("product1 , 5");
dataList.add("Product2 , 3");
StringBuilder fullString = new StringBuilder();
for (int i=0 ; i < dataList.size(); i++)
{
String splitedData = dataList.get(i).split(",");
fullString.append("Product : " + splitedData[0] + "n" + "Quantity : "+ splitedData[1]+"n");
}

ShareToWhatsapp(fullString.toString());
}





share|improve this answer


























  • Understood, but in my case i already have the Arraylist that's been feeded from the firestore. it's a shopping list with the list from the client.

    – Allan Jaqueira
    Nov 15 '18 at 19:13













Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53324594%2fconvert-arraylist-to-a-list-of-items-to-share-through-whatsapp%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














So you want to convert the ArrayList which contains strings as
" product1 , 5 "
"Product2 , 3" ...
To one String to share? If so you can use this code.



{
ArrayList<String> dataList = new ArrayList<>();
// Your arraylist that contains all the data
dataList.add("product1 , 5");
dataList.add("Product2 , 3");
StringBuilder fullString = new StringBuilder();
for (int i=0 ; i < dataList.size(); i++)
{
String splitedData = dataList.get(i).split(",");
fullString.append("Product : " + splitedData[0] + "n" + "Quantity : "+ splitedData[1]+"n");
}

ShareToWhatsapp(fullString.toString());
}





share|improve this answer


























  • Understood, but in my case i already have the Arraylist that's been feeded from the firestore. it's a shopping list with the list from the client.

    – Allan Jaqueira
    Nov 15 '18 at 19:13


















0














So you want to convert the ArrayList which contains strings as
" product1 , 5 "
"Product2 , 3" ...
To one String to share? If so you can use this code.



{
ArrayList<String> dataList = new ArrayList<>();
// Your arraylist that contains all the data
dataList.add("product1 , 5");
dataList.add("Product2 , 3");
StringBuilder fullString = new StringBuilder();
for (int i=0 ; i < dataList.size(); i++)
{
String splitedData = dataList.get(i).split(",");
fullString.append("Product : " + splitedData[0] + "n" + "Quantity : "+ splitedData[1]+"n");
}

ShareToWhatsapp(fullString.toString());
}





share|improve this answer


























  • Understood, but in my case i already have the Arraylist that's been feeded from the firestore. it's a shopping list with the list from the client.

    – Allan Jaqueira
    Nov 15 '18 at 19:13
















0












0








0







So you want to convert the ArrayList which contains strings as
" product1 , 5 "
"Product2 , 3" ...
To one String to share? If so you can use this code.



{
ArrayList<String> dataList = new ArrayList<>();
// Your arraylist that contains all the data
dataList.add("product1 , 5");
dataList.add("Product2 , 3");
StringBuilder fullString = new StringBuilder();
for (int i=0 ; i < dataList.size(); i++)
{
String splitedData = dataList.get(i).split(",");
fullString.append("Product : " + splitedData[0] + "n" + "Quantity : "+ splitedData[1]+"n");
}

ShareToWhatsapp(fullString.toString());
}





share|improve this answer















So you want to convert the ArrayList which contains strings as
" product1 , 5 "
"Product2 , 3" ...
To one String to share? If so you can use this code.



{
ArrayList<String> dataList = new ArrayList<>();
// Your arraylist that contains all the data
dataList.add("product1 , 5");
dataList.add("Product2 , 3");
StringBuilder fullString = new StringBuilder();
for (int i=0 ; i < dataList.size(); i++)
{
String splitedData = dataList.get(i).split(",");
fullString.append("Product : " + splitedData[0] + "n" + "Quantity : "+ splitedData[1]+"n");
}

ShareToWhatsapp(fullString.toString());
}






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 15 '18 at 18:26

























answered Nov 15 '18 at 18:16









raed ghazalraed ghazal

104




104













  • Understood, but in my case i already have the Arraylist that's been feeded from the firestore. it's a shopping list with the list from the client.

    – Allan Jaqueira
    Nov 15 '18 at 19:13





















  • Understood, but in my case i already have the Arraylist that's been feeded from the firestore. it's a shopping list with the list from the client.

    – Allan Jaqueira
    Nov 15 '18 at 19:13



















Understood, but in my case i already have the Arraylist that's been feeded from the firestore. it's a shopping list with the list from the client.

– Allan Jaqueira
Nov 15 '18 at 19:13







Understood, but in my case i already have the Arraylist that's been feeded from the firestore. it's a shopping list with the list from the client.

– Allan Jaqueira
Nov 15 '18 at 19:13






















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53324594%2fconvert-arraylist-to-a-list-of-items-to-share-through-whatsapp%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Florida Star v. B. J. F.

Error while running script in elastic search , gateway timeout

Adding quotations to stringified JSON object values