Win a copy of liveProject: Protecting User Data with Spring Security and OAuth2 this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

Add string to listview

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have an app that the user can use to make a few selections. The selections are saved in a String. I can print out the String in a small textview in the same activity. I want to pass it to another activity and then print the string in a listview or maybe a recyclerview would be better?

I really have a hard time understanding how to add to listview.

I know it is a bit messy since Im reusing an older code but I hope you understand it. Anyway here is my code so far:

 
Saloon Keeper
Posts: 8061
70
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
 
Hugge Nilsson
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes! Sorry I forgot to mention that
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


To move a string from 1 activity to another,



 
Hugge Nilsson
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you! And how do I add that to a Listview in the other activity. I can't wrap my head around it
 
Saloon Keeper
Posts: 6917
163
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's line 8 - 10 in Jason's code. Put that in the onCreate method of the other activity, and then you can do with "value" whatever you like.
 
Jason Edwards
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hugge Nilsson wrote:Thank you! And how do I add that to a Listview in the other activity. I can't wrap my head around it


Your welcome Hugge Nilsson.
Just wondering, have you developed android Applications on Android Studio?

As you need code for the GUI (xml), and Java/Kotlin code for the back end. The code you put up looks like a coffee app built in Java code, only as a test( online android course).

For Android development, most developers are moving over to kotlin, its faster and and easier to work with.





 
Hugge Nilsson
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes Jason it's not compeletely my code but I use it as a base to get all the functions. I'm still an absolute beginner.
 
Jason Edwards
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hugge Nilsson wrote:Yes Jason it's not completely my code but I use it as a base to get all the functions. I'm still an absolute beginner.



If your absolute beginner, you need to start from the beginning, I would start off with this course https://www.youtube.com/watch?v=uRyvNKRkwbs
I have been building apps on android studio for a few years, If you get stuck let me know and I will do my best to help.








 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic