File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Android and the fly likes How to check equality of strings ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "How to check equality of strings ?" Watch "How to check equality of strings ?" New topic
Author

How to check equality of strings ?

chetan dhumane
Ranch Hand

Joined: Jan 07, 2009
Posts: 629


I am getting exception on phone activity named "i" can't start.

Thanks


http://www.androcid.com/
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

What's 'i' and 'j' ?


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Imran Mohd
Ranch Hand

Joined: Mar 02, 2009
Posts: 38
hey how can we help you if your not providing the complete code...


Cheers,
Mohd Imran (SCJP 1.5)
chetan dhumane
Ranch Hand

Joined: Jan 07, 2009
Posts: 629



Here is complete code
All intents are properly initialized int Manifest file .
Rohan Dhruva
Ranch Hand

Joined: May 08, 2007
Posts: 183
Strings in android are normal Java strings - your use of .equals() is quite appropriate, the problem must lie somewhere else.


Rohan B. Dhruva
SCJP 1.5
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1



A silly doubt, Is this class (Notepadv3.class) visible ?
Rohan Dhruva
Ranch Hand

Joined: May 08, 2007
Posts: 183
Also, every new activity you create must be added to the android manifest.xml..
chetan dhumane
Ranch Hand

Joined: Jan 07, 2009
Posts: 629

Notpadv3 is visible.

All classes are registered into the Manifest file.

I can run Notepadv3 manually.
Monu Tripathi
Rancher

Joined: Oct 12, 2008
Posts: 1369
    
    1

Can you post a dump of your exception? That way people wont be shooting in dark..

Thanks.


[List of FAQs] | [Android FAQ] | [Samuh Varta]
chetan dhumane
Ranch Hand

Joined: Jan 07, 2009
Posts: 629


View complete dump , which I get using adb

Line number 10 is the exception
Imran Mohd
Ranch Hand

Joined: Mar 02, 2009
Posts: 38
Hey you are Calling showDialog(DIALOG_TEXT_ENTRY); from onCreate() method which display the Dialog immediately
when the Activity get started ,Than how can enter any thing in to the EditText ..

And one more thing mUserText.getText() will return Editable object not the String object

so try using mUserText.getText().toString()

Ed Burnette
Author
Ranch Hand

Joined: Jun 10, 2003
Posts: 142
There are two problems in the code:

1. The two text fields don't exist in the original activity so they're being set to null. You need to find them in the view that you inflated, like this:

2. getText() is returning an Editable object. Usually you can use Editable wherever you use a String because they both implement CharSequence, but not in this case. Sorry I forgot to mention this earlier. The fix is to call toString() in the middle like this:


Ed Burnette, Author of Hello Android
Blog: ZDNet's Dev Connection - Twitter: @eburnette
chetan dhumane
Ranch Hand

Joined: Jan 07, 2009
Posts: 629

Thanks alot.
Once again javranch rocks.
chetan dhumane
Ranch Hand

Joined: Jan 07, 2009
Posts: 629


No i checked all the things it recognizes the click but it does not start a new activity.
I tried using Toast in the click event it goes upto that event but when i check for the equality it fails.
chetan dhumane
Ranch Hand

Joined: Jan 07, 2009
Posts: 629

Hello Imran ,

I have to use EditText while reading from textbox ,Am i right ?
Ed Burnette
Author
Ranch Hand

Joined: Jun 10, 2003
Posts: 142
I made the changes above in my copy and it worked fine. Of course there's some bad recursion going on (an activity launching itself) but I assume that's just temporary code for demonstration.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to check equality of strings ?