-----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Raymond Rodgers Sent: Sunday, January 04, 2009 11:45 AM To: [email protected] Subject: [android-beginners] Re: notification
Teena wrote: > Thanks for the response, Cyril. Is this how I would do it? I'm still > not seeing any text feedback on the screen when I click the button. > Log will put strings into a log that's viewable in debug mode in Eclipse with the Logcat view added to the overall list of views. That's very useful for debugging purposes [obviously] without displaying anything to the app's user. However, if you want to display something on screen, you can use the Toast class http://code.google.com/android/reference/android/widget/Toast.html to display a message on screen briefly. The message will fade automatically after a short amount of time, and could be useful for what you're trying to accomplish. Raymond Thanks Raymond, I really appreciate the help. One more question though, I'm trying to use the toast widget properly, but cannot figure out the 'context' that I need to put in as a parameter. Updated code below: package test.app; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.Toast; public class test_app extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); /* Find the button from our XML-layout. */ Button b = (Button)this.findViewById(R.id.btn_open_search); b.setOnClickListener(new OnClickListener() { public void onClick(View agr0) { // Place code to handle button click here Toast.makeText(test_app, "btn-click", 9); } }); } } The error I'm getting is 'test_app' cannot be resolved, but test_app is my activity as specified in the AndroidManifest.xml. What am I doing wrong? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---

