Google Play Newsstand 3.3 Brings Material Design Makeover

In a clear break from the previous practice of delivering nearly weekly Google … more

App Review: Calculating Your Android Calculator Options

Sure, everyone has a default Calculator and its something that you dont think about … more

MultiROM Once Again Available for the Galaxy S4

Multiboot, or the ability to select betweenmultiple operating systems on a single device at … more

Build an Impractical But Awesome Lego Mindstorm Dock

The vast majority of what we cover here on the XDA-Developers News Portal relates to … more
Post Reply

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: 384
 
1,096 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, 09:11 AM   |  #12  
Devesh25's Avatar
OP Member
Flag Mumbai
Thanks Meter: 6
 
71 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, 10:26 AM   |  #13  
arpitkh96's Avatar
Senior Member
Flag panipat
Thanks Meter: 384
 
1,096 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, 08:57 PM   |  #14  
Masrepus's Avatar
Senior Member
Thanks Meter: 74
 
662 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, 05: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


Top Threads in Java for Android App Development by ThreadRank