Results 1 to 3 of 3
  1. #1
    AmitShef is offline Member
    Join Date
    Jun 2014
    Posts
    1
    Rep Power
    0

    Default How to return a string from java project into android project

    I tried many times to return a string from java project to an android project But it keeps sending incorrect values as in 2 as it should be 1 here is an example.

    Java Project:

    Java Code:
    boolean somethingboolean = false;  
    if(something == "1"){  
    somethingboolean = true;  
    }  
      
    public static String getString(){  
    if(somethingboolean == true){  
    return "TRUE";  
    }else{  
    return "FALSE";  
    }  
    }

    Android project:

    Java Code:
    System.out.println(JavaProject.getString())
    and in the android project it prints "FALSE"

    So what should i do? Thanks for all...

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,397
    Rep Power
    25

    Default Re: How to return a string from java project into android project

    One problem I see is the use of == to compare Strings. You should use the equals() method.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,958
    Rep Power
    8

    Default Re: How to return a string from java project into android project

    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Java Android Project
    By Luci in forum Android
    Replies: 5
    Last Post: 06-30-2014, 03:57 AM
  2. Replies: 7
    Last Post: 11-27-2012, 10:16 AM
  3. Java/Android/Php project?
    By SandManTFC in forum New To Java
    Replies: 0
    Last Post: 01-22-2012, 10:40 PM
  4. Replies: 1
    Last Post: 04-08-2010, 09:45 PM
  5. J2ME/Android Video Streaming Project
    By mox27 in forum Forum Lobby
    Replies: 4
    Last Post: 04-06-2009, 08:48 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •