5,597,354 Members 32,520 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 342
Posts: 987
Join Date: Feb 2012
Location: panipat
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:
 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

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 342
Posts: 987
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 54
Posts: 576
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: 18
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

Clean Up Your Logcat Code with Lib Cleaner

Some of you may think that writing code is the hardest part of development. It’s not, as the … more

Tweak Your Xperia Device’s Camera App Yourself

We’ve come to expect nearly perfect cameraperformancein our modern day … more