Results 1 to 2 of 2
  1. #1
    MichaelC is offline Member
    Join Date
    Jan 2013
    Posts
    1
    Rep Power
    0

    Default Globale variable for all classes

    I'm making a game, and i want some help, so if someone can help me? it would be helpfull! :D
    i have more than 1 question so i hope i can talk to him in private chat.

    but one of my question is, i want to make a integer score; for counting the score.. logic.
    and i made in one class the mainscreen, and in another class the screen where you can get the points.
    so i made in mainscreen a textview that displays the score. And a button to go to the other screen. When i got to the other screen and i push a button, i need to do: score = score + 1; but how to attach score in another screen / class?

    Hope you can answer my question! Thanks!

  2. #2
    tamilarasi is offline Member
    Join Date
    Nov 2012
    Location
    India
    Posts
    70
    Rep Power
    0

    Default Re: Globale variable for all classes

    Quote Originally Posted by MichaelC View Post
    I'm making a game, and i want some help, so if someone can help me? it would be helpfull! :D
    i have more than 1 question so i hope i can talk to him in private chat.

    but one of my question is, i want to make a integer score; for counting the score.. logic.
    and i made in one class the mainscreen, and in another class the screen where you can get the points.
    so i made in mainscreen a textview that displays the score. And a button to go to the other screen. When i got to the other screen and i push a button, i need to do: score = score + 1; but how to attach score in another screen / class?

    Hope you can answer my question! Thanks!
    Hi,

    have you used sharedpreference that is global variable
    you used this logic and create variable then use all class on between your project...

    Thanks,

Similar Threads

  1. Passing a variable between classes
    By Nanomech in forum New To Java
    Replies: 4
    Last Post: 08-22-2011, 12:29 PM
  2. Shared variable for other classes
    By Cemi in forum New To Java
    Replies: 20
    Last Post: 04-09-2010, 11:42 PM
  3. Use 1 variable in different bean/classes
    By maneuk in forum Eclipse
    Replies: 14
    Last Post: 04-09-2010, 03:19 PM
  4. variable scope between classes
    By newbie123 in forum New To Java
    Replies: 6
    Last Post: 03-03-2010, 11:20 PM
  5. Passing variable information between classes
    By zen_to_go in forum New To Java
    Replies: 1
    Last Post: 10-30-2007, 08:09 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •