Official TWRP Recovery Lands on Micromax Canvas Magnus

With the recent release of Android One, Micromax and MediaTek released fully buildable … more

Update Overload: SuperSU Heavily Updated

There are apps and apps out there. Very few can reach the level of popularity required to stay at … more

Lollipop Leak Available for the Sprint Galaxy S5

Since the Android 5.0Lollipop’s official release not too long ago, we’ve seen … more

CPU Spy Gets an Android Lollipop Makeover

At some point in the distant past, you probably heard of CPU Spy for Android by XDARetired … more

Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

need help for some java errors in edittext widget xml

OP Devesh25

13th January 2014, 07:31 PM   |  #11  
arpitkh96's Avatar
Senior Member
Flag panipat
Thanks Meter: 525
 
1,103 posts
Join Date:Joined: Feb 2012
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, 10:11 AM   |  #12  
Devesh25's Avatar
OP Member
Flag Mumbai
Thanks Meter: 7
 
76 posts
Join Date:Joined: Dec 2013
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, 11:26 AM   |  #13  
arpitkh96's Avatar
Senior Member
Flag panipat
Thanks Meter: 525
 
1,103 posts
Join Date:Joined: Feb 2012
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, 09:57 PM   |  #14  
Masrepus's Avatar
Senior Member
Thanks Meter: 78
 
691 posts
Join Date:Joined: Feb 2013
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, 06:25 PM   |  #15  
emerals stream's Avatar
Junior Member
Thanks Meter: 3
 
20 posts
Join Date:Joined: Nov 2013
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