hello pogz
i got error at statement:
showAlert("Crap!", "Couldn't find the 'txt_username' or 'txt_password' "
the error is :
The method showAlert(String, String, String, boolean) is undefined for the type new View.OnClickListener(){}
pls help me.


plusminus wrote:Hey pogz,
you do that with the following BB-Tags-Style:Using xml Syntax Highlighting
[ syntax = " language " ] YOUR_CODE [ / syntax ] where language == java or language == xml or most other languages...Parsed in 0.000 seconds, using GeSHi 1.0.8.4
Yes you are right, I will do a posting-guide or a kinda 'template' tomorrow
Regards,
plusminus


[font=Arial Black] [/font]venkat wrote:Hi cybersat,
you may be forgot to update the main.xml file here.
just copy main.xml file aboveand past it in your main.xml file . it will be in inside the res-->layout.
i have attached full project here. have a look.
regards,
venkat



Sivan wrote:Hi pogz...
Nice tutorial, I really liked it , but there is 1 prob
The layout is perfect but the java coding has a problem
When I run the application on the Emulator, Its running but when i click Login its doing nothing......
Project Details ::::::
Application Name: Hello Android
Project Name: Hello Android
Package Name: com.hello.android
SDK version : 8 (android 2.2)
Help will be appriciated


sainath wrote:Hi
I am new to Mobile Development and just recently i started playing with Android.
As i was trying this example in android-sdk-windows-1.0_r2.zip, i am getting an error
"The method showAlert(String, String, String, boolean) is undefined for the type new View.OnClickListener(){}"
so i used Toast instead and it worked,
Toast.makeText(LoginPage.this, "Couldn't find the 'txt_username' or 'txt_password'",
Toast.LENGTH_SHORT).show();
but i want to know whether showAlert Exists in present sdk release or it has been removed or its a user defiend function.



anilexotrac wrote:hi,
i am very new to android application.
i have made identical login application with same codings.
but whenever i click ok button, its not showing any message. what may be the cause.
hope to hear soon from you.
thanks



Sivan wrote:Hi pogz...
Nice tutorial, I really liked it , but there is 1 prob
The layout is perfect but the java coding has a problem
When I run the application on the Emulator, Its running but when i click Login its doing nothing......
This is your Code:
________________________________________________________________________________________Using java Syntax Highlighting
package pogz.test; 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; /** * Application Name: <span class="posthilit">Generic</span> <span class="posthilit">Login</span> Screen for the Android Platform (back end) * Description: This is <span class="posthilit">a</span> <span class="posthilit">generic</span> <span class="posthilit">login</span> screen which catches the username and password values * Created on: November 23, 2007 * Created by: Pogz Ortile * Contact: pogz(at)redhat(dot)polarhome(dot)com * Notes: The string values for username and password are assigned to sUserName and sPassword respectively * You are free to distribute, modify, and wreck for all I care. GPL ya! * */ public class PogzTest01 extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); // load up the layout setContentView(R.layout.main); // get the button resource in the xml file and assign it to <span class="posthilit">a</span> local variable of type Button Button launch = (Button)findViewById(R.id.login_button); // this is the action listener launch.setOnClickListener( new OnClickListener() { public void onClick(View viewParam) { // this gets the resources in the xml file and assigns it to <span class="posthilit">a</span> local variable of type EditText EditText usernameEditText = (EditText) findViewById(R.id.txt_username); EditText passwordEditText = (EditText) findViewById(R.id.txt_password); // the getText() gets the current value of the text box // the toString() converts the value to String data type // then assigns it to <span class="posthilit">a</span> variable of type String String sUserName = usernameEditText.getText().toString(); String sPassword = passwordEditText.getText().toString(); // this just catches the error if the program cant locate the GUI stuff if(usernameEditText == null || passwordEditText == null){ showAlert("Crap!", "Couldn't find the 'txt_username' or 'txt_password' " + "EditView in main.xml", "Oh shit!", false); }else{ // display the username and the password in string format showAlert("Logging in", "Username: " + sUserName + "nPassword: " + sPassword , "Ok", true); } } } ); // end of launch.setOnclickListener } }Parsed in 0.042 seconds, using GeSHi 1.0.8.4
__________________________________________________________________________________________________
And this is my code :Using java Syntax Highlighting
package com.android.hello; 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; import android.os.Bundle; public class Android extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Button launch = (Button)findViewById(R.id.widget33); // this is the action listener launch.setOnClickListener( new OnClickListener() { public void onClick(View viewParam) { // this gets the resources in the xml file and assigns it to a local variable of type EditText EditText usernameEditText = (EditText) findViewById(R.id.widget29); EditText passwordEditText = (EditText) findViewById(R.id.widget30); // the getText() gets the current value of the text box // the toString() converts the value to String data type // then assigns it to a variable of type String String sUserName = usernameEditText.getText().toString(); String sPassword = passwordEditText.getText().toString(); // this just catches the error if the program cant locate the GUI stuff if(usernameEditText == null || passwordEditText == null){ showAlert("Crap!", "Couldn't find the 'txt_username' or 'txt_password' " + "EditView in main.xml", "Oh shit!", false); }else{ // display the username and the password in string format showAlert("Logging in", "Username: " + sUserName + "nPassword: " + sPassword , "Ok", true); } } } ); // end of launch.setOnclickListener } protected void showAlert(String string, String string2, String string3, boolean b) { // TODO Auto-generated method stub } } Parsed in 0.044 seconds, using GeSHi 1.0.8.4
Project Details ::::::
Application Name: Hello Android
Project Name: Hello Android
Package Name: com.hello.android
SDK version : 8 (android 2.2)
Help will be appriciated


Users browsing this forum: No registered users and 5 guests