FORUMS

XDA Office Space: Frankenstein’s Perfect IM Client?

The portal’s decentralized XDA office lies in a Hangouts chatroom, where … more

Which IM Client on Android is best?

With so many different messengers to choose from, it can be tough to find the best one for you and … more

Android Factory Reset Security Flaw and More – XDA TV

Nvidia is releasing a 500Gb SHIELD TV Pro! That and much more news is … more

Android M Code Name: Macadamia Nut Cookie

While the official name for the latest iteration of Android has yet to be revealed, the code … more
Post Reply Subscribe to Thread Email Thread

need help for some java errors in edittext widget xml

13th January 2014, 06:31 PM |#11  
arpitkh96's Avatar
Senior Member
Flag panipat
Thanks Meter: 577
 
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: 577
 
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