Hey guys, just need to vent a little.
So, here’s the story. I was developing an Android app for a client, but a simple issue like a Toast not appearing somehow turned my thought process upside down. Why? Because I was narrowly focused on the code alone. As a result, my debugging steps went way off track, and even when googling, I used overly complex keywords.
At one point, I even created a new activity and a new fragment solely for displaying the Toast, but still, the outcome was the same.
Generally, my app was running smoothly with clean code and no errors. But this one issue with the Toast made me so curious.
Long story short, I got exhausted from googling, and I tried almost every suggestion I could find in the code project, though with no success. I treated it as a learning process and eventually returned my project code to its original state.
Taking a break and having a coffee restored my sanity. During the break, I kept thinking about this problem, which reassured me that my code was correct. Eventually, this led me to start thinking “out of the box.”
Here’s a snippet of my code at that time:
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
Log.d(TAG, "***************************");
Log.d(TAG, "*** Application started ***");
Log.d(TAG, "***************************");
// assign layout to activity
setContentView(R.layout.activity_main);
mContext = MainActivity.this;
Toast.makeText(mContext, "Hello World", Toast.LENGTH_SHORT).show();
}