This week's book giveaway is in the Spring forum.
We're giving away four copies of Java Persistence with Spring Data and Hibernate and have Cătălin Tudose on-line!
See this thread for details.
Win a copy of Java Persistence with Spring Data and Hibernate 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
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

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: 9951
81
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: 14
  • 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
 
Bartender
Posts: 7488
171
  • 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: 14
  • 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: 14
  • 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.








 
Drove my Chevy to the levee but the levee was dry. A wrung this tiny ad and it was still dry.
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic