FORUMS

Index Project For XDA Device Subforums

Another ambitious project from the collaborative efforts of Recognized Contributors and Forum … more

The Atlas of XDA

A few weeks ago, we asked you “How Does Your Location Affect Your Life As A Power User?”. In the days that … more

New Snapdragons: Some Context & Contrast

It hasn’t been a good year for Qualcomm so far. Every device featuring the Snapdragon 810 … more

Google To Launch Next Gen Android One On July 14

The first gen of Android One devices to be launched in India in September 2014 were … more

need help for some java errors in edittext widget xml

82 posts
Thanks Meter: 8
 
By Devesh25, Member on 9th January 2014, 09:09 AM
Post Reply Subscribe to Thread Email Thread
13th January 2014, 06:31 PM |#11  
arpitkh96's Avatar
Senior Member
Flag panipat
Thanks Meter: 581
 
Donate to Me
More
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: [ View ]
 
 
14th January 2014, 09:11 AM |#12  
Devesh25's Avatar
OP Member
Flag Mumbai
Thanks Meter: 8
 
More
Quote:
Originally Posted by arpitkh96

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)
14th January 2014, 10:26 AM |#13  
arpitkh96's Avatar
Senior Member
Flag panipat
Thanks Meter: 581
 
Donate to Me
More
Quote:
Originally Posted by Devesh25

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
14th January 2014, 08:57 PM |#14  
Masrepus's Avatar
Senior Member
Thanks Meter: 93
 
More
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: [ View ]
16th January 2014, 05:25 PM |#15  
emerals stream's Avatar
Junior Member
Thanks Meter: 3
 
More
you are trying to assign vlaue to a final variable, you can't do this.
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes