Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Help with android button

Options
  • 20-03-2014 11:05pm
    #1
    Registered Users Posts: 72 ✭✭


    Hi folks
    i new to android development and have a sample app but there are couple things i need help with if someone can assist me with as could not find anything easy by googling it...

    the first thing i have few buttons which i need like an arrow on them.... for instance on my start up screen i have a button "proceed" but would like an arrow on it pointing to the right...

    second of all my 2nd screen (main activity) has an EditText and a button to "Add Site" which when is pressed brings the user to the 3rd screen which is where they enter details of the Site in edittext fields... and at the bottom of this screen i have a button "Save Site Details" ....

    When this button is pressed i need to populate screen 2... (line by line if possible depending on how many sites the user adds)...

    Can anyone assist me with this please...

    many thanks in advance


Comments

  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    shanard wrote: »
    the first thing i have few buttons which i need like an arrow on them.... for instance on my start up screen i have a button "proceed" but would like an arrow on it pointing to the right...
    Use an ImageButton.
    second of all my 2nd screen (main activity) has an EditText and a button to "Add Site" which when is pressed brings the user to the 3rd screen which is where they enter details of the Site in edittext fields... and at the bottom of this screen i have a button "Save Site Details" ....

    When this button is pressed i need to populate screen 2... (line by line if possible depending on how many sites the user adds)...
    Save your details when they press the "Save Site Details" button and then end the 3rd screen Activity. This will bring you back to the 2nd screen / activity (which has been lurking in the background). There you can catch the event of this activity regaining focus with onResume and using that you can then grab your saved details and populate the screen accordingly.


  • Registered Users Posts: 72 ✭✭shanard


    Use an ImageButton.

    i have used an imagebutton here and set background to @drawables/arrow_button which is one i did using photoshop..... now although it doesnt look too bad, i still would not be happy with it.... i am sure there is another easy way within xml but just cant find out how??....

    Save your details when they press the "Save Site Details" button and then end the 3rd screen Activity. This will bring you back to the 2nd screen / activity (which has been lurking in the background). There you can catch the event of this activity regaining focus with onResume and using that you can then grab your saved details and populate the screen accordingly.

    When you say end the 3rd screen which will bring me back to the 2nd.... is this done in the onDestroy() ????

    And when the save site button is clicked i want to populate the 2nd screen where i want these sites to stay there until the user edits/deletes them so would i use SharedPreferences for this or what way would i store them??..

    Thanks


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    shanard wrote: »
    When you say end the 3rd screen which will bring me back to the 2nd.... is this done in the onDestroy() ????
    No need to go there. Unless you explicitly terminate the second screen when launching the third, it'll still be there 'behind' the new screen (that's why pressing the back button will bring you back there). As such, just terminating the third activity, for example with finish(), will do the trick and onResume will kick in whenever you return to the screen/activity it's associated with. There are examples online, if you wish to Google them.
    And when the save site button is clicked i want to populate the 2nd screen where i want these sites to stay there until the user edits/deletes them so would i use SharedPreferences for this or what way would i store them??..
    Up to you. SharedPreferences, SQLite, a local text file, whatever - there are a few options. All have pros and cons and which is best really depends overall on your application, desired functionality and essentially using the right tool for the job. As you seem to want to create a list of (more than one) entries, then my feeling is that SharedPreferences would not be a good idea.

    I suggest you read an article on persistent data in Android, to understand your options better, before choosing what route to take.


Advertisement