Skip to content
Coding Fanatic
  • Android Development
  • News and Reviews
  • Road2Pro
  • Tutorials
  • Services
  • About

Setting Up Boundaries, 56 of 100 Days of Code

  • December 19, 2019December 19, 2019
  • by Richard Clarke

I set up some ground rules for how my app will deal with user input.

You can find a video at the bottom of the page and a link to the source code here.

I added some logic to the EditText field in the Search Activity based on two possible outcomes: when the field is empty, or when it contains text. I started by creating a new ArrayAdapter which holds a single String object which reads “NO RESULTS FOUND”.

When the EditText field is empty, the list updates with the ArrayAdapter containing the entire list of addresses. If the EditText field contains text entered by the user, the list updates with the ArrayAdapter which says “NO RESULTS FOUND”.

This means that if the user enters text and hits enter, the app, currently, says there are no results. Clearing the text also displays the full list again.

I realized the error in my prior approach. I was trying to include the target functionality for the Search Activity without setting any boundaries. This time, I did the reverse.

Starting with the logic for an empty EditText and one with erroneous text, I have room to focus on the actual search logic. I’ll keep this in mind when working on features for apps in the future.

These changes are a placeholder for the time being. Soon I will write the actual logic for this. At this time, I have proof the list will update if text is added.

Picking up where I left off last time, I’m going to add the substitute Homes object. This will be used to store a copy of Homes objects and allow the application to invoke methods from the Homes class.

For more on this, watch the YouTube video below. For the source code click here.

Join the mailing list to see updates like this every week!
Coding Fanatic

Image by Nikki Wyatt from Pixabay

Related

Objects Are a Real Trip, 55/100 Days of Code
Rebuild and Retry, 57 of 100 Days of Code
Richard Clarke
Richard is currently a developer using Java and Android Studio to build custom applications for Android. Richard tutored in mathematics at Montgomery College, and worked in Information Technology before entering the Software Development industry as a Quality Engineer.
100daysofcode Android AndroidDev Java

Related articles

Your New Favorite Stopwatch App!…
Two for Two BABY! 7…
…But the App is for…
Play Store Blues – 5…
Top 4 Tips for Android…
No Dice – 3 of…

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Join the mailing list!

This field is required.

Check your inbox or spam folder to confirm your subscription.

Follow me on social media!

  • GitHub
  • YouTube
  • X
  • Instagram
  • LinkedIn
My Tweets

Join the mailing list!

This field is required.

Check your inbox or spam folder to confirm your subscription.

Follow me on social media!

  • X
  • GitHub
  • LinkedIn
  • YouTube

Archives

Theme by Colorlib Powered by WordPress