Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,742,912 Members 40,847 Now Online
XDA Developers Android and Mobile Development Forum

need help for some java errors in edittext widget xml

Tip us?
 
arpitkh96
Old
#11  
arpitkh96's Avatar
Senior Member
Thanks Meter 375
Posts: 1,085
Join Date: Feb 2012
Location: panipat
Code:
Select Code
 package com.example.sample;

import android.app.*;
import android.os.*;
import android.view.*;
import android.widget.*;

public class MainActivity extends Activity {
public String word="myword";
public String check;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);



}public void click(View v){

final TextView textview = (TextView) findViewById(R.id.textView1);
final EditText edittext = (EditText) findViewById(R.id.editText1);
check = edittext.getText().toString();

if (check.equals(word)) {

textview.setText("correct");

}else{textview.setText("incorrect");}


}
}
Sent from my GT-S5570 using XDA Premium 4 mobile app
The Following User Says Thank You to arpitkh96 For This Useful Post: [ Click to Expand ]
 
Devesh25
Old
#12  
Devesh25's Avatar
Member - OP
Thanks Meter 6
Posts: 68
Join Date: Dec 2013
Location: Mumbai
Quote:
Originally Posted by arpitkh96 View Post
Code:
Select Code
 package com.example.sample;

import android.app.*;
import android.os.*;
import android.view.*;
import android.widget.*;

public class MainActivity extends Activity {
public String word="myword";
public String check;

@Override
protected void onCreate(Bundle savedInstanceState) {
s....
Sent from my GT-S5570 using XDA Premium 4 mobile app

awesome dude thanks now its working,
can you explain me what is the reason of using (View v) instead of (View view)

Hit Thanks if i help you
Donate me by just clicking this URL>>> http://sh.st/eMMEA



Phone:Samsung Galaxy R
Android Verison:4.4.2
Model:GT-I9103

Future is what you make it

 
arpitkh96
Old
#13  
arpitkh96's Avatar
Senior Member
Thanks Meter 375
Posts: 1,085
Join Date: Feb 2012
Location: panipat
Quote:
Originally Posted by Devesh25 View Post
awesome dude thanks now its working,
can you explain me what is the reason of using (View v) instead of (View view)

v is same as your view.
Just a variable

Sent from my GT-S5570 using XDA Premium 4 mobile app
 
Masrepus
Old
#14  
Masrepus's Avatar
Senior Member
Thanks Meter 70
Posts: 637
Join Date: Feb 2013
You can name it the way you like, the inly important thing is the data type, in this case View

---------------------------------
Phone : My new Nexus 4!
OS:
Pure KitKat 4.4.2 stock, no root, no mods (but only for the first time ;D)
---------------------------------

Gesendet von Tapatalk
The Following User Says Thank You to Masrepus For This Useful Post: [ Click to Expand ]
 
emerals stream
Old
#15  
emerals stream's Avatar
Junior Member
Thanks Meter 2
Posts: 19
Join Date: Nov 2013
you are trying to assign vlaue to a final variable, you can't do this.
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


XDA PORTAL POSTS

Slide Dial Replacement Dialer Lets You Make Calls from Anywhere

If you frequently make phone calls, your dialer (aka phone app)is one of the … more

Navigate with Your Samsung Gear 2 Using DMA Navi Watch

Whether you’re travelling to a new destination or exploring some previously … more

Xperia Z1 Stereo Speaker Mod, Cell Phone Unlocking Legal Again! – XDA Developer TV

Cell Phone Unlocking is legal again!! That and much … more