New help in showAlert function

Basic Tutorials concerning: GUI, Views, Activites, XML, Layouts, Intents, ...

New help in showAlert function

Postby tappy » Thu May 28, 2009 10:34 am

Hi ,

can anyone help me, i don't understand why my showAlert is not working it said "The method showAlert(String, String) for the type new.View.onClickListener(){}". Thanks for helping

Below is my code:
package dev.contractTracing;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class ContactTracing extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main); //R.layout.FILE_NAME

//Start of Clear Button Function
Button clearButton = (Button)findViewById(R.id.btn_clear);
clearButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
EditText name = (EditText)findViewById(R.id.tb_name);
EditText NRIC = (EditText)findViewById(R.id.tb_nric);
name.setText("");
NRIC.setText("");
}
});
//End of Clear Button Function

//Start of Save Button Function
Button saveButton = (Button)findViewById(R.id.btn_save);
clearButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
EditText name = (EditText)findViewById(R.id.tb_name);
EditText NRIC = (EditText)findViewById(R.id.tb_nric);

if((name == null)||(NRIC == null)){
showAlert("A funny title", "MessageBoxes rule extremely!");

}
}
});
}
}
tappy
Freshman
Freshman
 
Posts: 8
Joined: Thu May 28, 2009 10:28 am

Top

Postby today913 » Sun May 31, 2009 4:34 am

if the vertion of your sdk is after 0.9r1, you can not use the function showAlert(), because it is removed from Android SDK
today913
Freshman
Freshman
 
Posts: 5
Joined: Sun May 31, 2009 4:25 am

showalert function not working in android sdk 2.0

Postby hPushpa18 » Mon Mar 15, 2010 11:51 am

Hi,
If showAlert is not there in android sdk 2.0, can you please tell me other function which acts same as showAlert.i am using aandroid sdk 2.0

Thanks please help :?
hPushpa18
Junior Developer
Junior Developer
 
Posts: 14
Joined: Mon Nov 02, 2009 11:08 am
Location: Bangalore

Re: New help in showAlert function

Postby IcedTea » Tue Jan 04, 2011 6:25 pm

Hi.

I also would like to know what has replaced the showAlert() function in the Android SDK. Seems like documentation on what happened to it is scarce.

Thanks for the help.
IcedTea
Once Poster
Once Poster
 
Posts: 1
Joined: Tue Jan 04, 2011 6:22 pm

Top

Return to Novice Tutorials

Who is online

Users browsing this forum: No registered users and 12 guests