• 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
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Please, explain me how can I edit item of an arraylist

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry for bothering you again. I am making a simple program in which you create " Associates " for a club and add them to a list of "Associates". Then you display them in a list and below have two buttons that gives you the option to edit and delete them. I want to know what are the stepes to follow when one of them is selected and clicked in the ""edit " button. How can I modifiy only that "Associates" in the arraylist?
 
Ranch Hand
Posts: 62
5
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Javier Coronel wrote:sorry for bothering you again. I am making a simple program in which you create " Associates " for a club and add them to a list of "Associates". Then you display them in a list and below have two buttons that gives you the option to edit and delete them. I want to know what are the stepes to follow when one of them is selected and clicked in the ""edit " button. How can I modifiy only that "Associates" in the arraylist?


Firstly you should tell us what does "edit" mean to you. I suppose: open some sort of dialog where the user can view/change some informations, you should clarify. And you should also clarify which type of user interface you are developing: is it a Swing application? Is it a web application? If Swing, are you using JList? Or JTable for your associates?
 
Javier Coronel
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Andrea Binello wrote:

Javier Coronel wrote:sorry for bothering you again. I am making a simple program in which you create " Associates " for a club and add them to a list of "Associates". Then you display them in a list and below have two buttons that gives you the option to edit and delete them. I want to know what are the stepes to follow when one of them is selected and clicked in the ""edit " button. How can I modifiy only that "Associates" in the arraylist?


Firstly you should tell us what does "edit" mean to you. I suppose: open some sort of dialog where the user can view/change some informations, you should clarify. And you should also clarify which type of user interface you are developing: is it a Swing application? Is it a web application? If Swing, are you using JList? Or JTable for your associates?




No, i am developing for android, and i am using a listview that display all the "Associates" of the club. When you display each one of them you have two options, to "edit" or "delete" them. Yes, when you clicked in the edit button it should give you the option to change the information that was in the profile of that "Associate", for that i need to know who can i modify that "Associate" in the arraylist.

I know that this web is for java, but all that i develop in android is on java so i hope this topic is not out of place.

 
Marshal
Posts: 80765
488
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Android counts as Java, so that question is in place.

Please explain exactly what you want to do. Do you wish to alter the details of one of the associates? Do you want to remove associates altogether? ListView appears to be for displaying a List. What is the model behind your List? Is it an array list, or the list GUI component? If it is a GUI list, what is its model (again)? This Java Tutorials section might help you.
 
Javier Coronel
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Android counts as Java, so that question is in place.

Please explain exactly what you want to do. Do you wish to alter the details of one of the associates? Do you want to remove associates altogether? ListView appears to be for displaying a List. What is the model behind your List? Is it an array list, or the list GUI component? If it is a GUI list, what is its model (again)? This Java Tutorials section might help you.



Each "associate" when is display has two buttons one that edit him and the other gives you the option to delete him. What i need is the steps to follow when you clicked in one of the "associate" and select edit, what should i do next, display again the layout in which i created it or there is another way?

When i click in the edit button how i can go to edit that "associate" and not create a new one?

I upload the code so you can see:

I am from uruguay so you will see in the code the word "socio" that is spanish for associate. The same happens with: nombre = name, apellido = last name, estado civil = marital status, etc.

AltaSocio.java



alta_socio2.xml



lista_socio_main.xml



lista_socio.xml



ArrayAdapterSocio.java

 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Javier Coronel wrote:I upload the code so you can see:


Javier,

First: Your lines are much too long. I'd break them up myself, but you have hundreds of them, and it makes your thread very difficult to read.

Second: That is far too much code. If you want a quick response, I suggest you edit your post to include only relevant information (eg, perhaps only the code for a single associate). For more information, read the SSCCE page.

Third: I'm not familiar with Android, but a standard technique with Java GUI applications is to separate what you DO from how it is DISPLAYED as much as you possibly can. In regular Java, the normal way to change an item in an ArrayList is via its set(int, newValue) method, but I have no idea whether this function is "wrapped" by your Android classes or not.

Fourth: I suspect you will get answers a lot quicker in our Android forum, so I'm moving your post there.

HIH

Winston
 
Campbell Ritchie
Marshal
Posts: 80765
488
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Javier Coronel wrote: . . . I upload the code so you can see: . . .

I am afraid I shall go farther than Winston and say that the code does not help. Please write down very simply what you intend to do, not how you are trying to do it. Write so simply that the difference between English and Spanish doesn't matter.
 
Javier Coronel
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:

Javier Coronel wrote: . . . I upload the code so you can see: . . .

I am afraid I shall go farther than Winston and say that the code does not help. Please write down very simply what you intend to do, not how you are trying to do it. Write so simply that the difference between English and Spanish doesn't matter.



Sorry for that, i am new at this, and make a lot of mistakes. To put it simple I want to know how can i edit the attributes of a class, example "associate" "name". And i don´t know if when i click in the edit button of that associate i have to display again the layout in which i created him to edit him.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic