Results 1 to 4 of 4
  1. #1
    polhallen is offline Member
    Join Date
    Oct 2012
    Posts
    1
    Rep Power
    0

    Default methods with args (How call it?)

    Hello all! :-) I'm obviously newbie

    I've a method like this:

    public void putText(String text){
    int sdk = android.os.Build.VERSION.SDK_INT;
    if(sdk < 11) {
    android.text.ClipboardManager clipboard = (android.text.ClipboardManager) activity.getSystemService(Context.CLIPBOARD_SERVIC E);
    clipboard.setText(text);
    [...]

    this code check version of android sdk

    I don't understand I can start this method because has the args

    Using putText() I've an error:

    The method setText(String) in the type MyApp is not applicable for the arguments ()

    how I resolve?

    thanks!

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: methods with args (How call it?)

    You need to pass a String object into the method when calling it. If you haven't done so, consider going through some introductory Java tutorials before trying Android coding. It can save you from a world of pain and frustration. Please have a look here.

  3. #3
    Darkzombies is offline Senior Member
    Join Date
    Nov 2012
    Posts
    105
    Rep Power
    0

    Default Re: methods with args (How call it?)

    Simple, it needs the string input for it to return. I.E. putText("EXAMPLE"); rather than putText(); I agree with Fubarable, if you really don't even know that much, you should probably do some tutorials before even attempting.

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,303
    Rep Power
    20

    Default Re: methods with args (How call it?)

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. how can main call other methods?
    By rahuld.exe in forum New To Java
    Replies: 1
    Last Post: 04-06-2012, 01:19 PM
  2. Java Noob, trying to call methods from another methods
    By gabrielpr12 in forum New To Java
    Replies: 8
    Last Post: 11-17-2011, 09:07 PM
  3. how to call or use methods inside interface?
    By akhmad in forum New To Java
    Replies: 2
    Last Post: 11-10-2010, 09:55 AM
  4. Call Static Methods Outside Classes
    By Insomniac Riot in forum New To Java
    Replies: 4
    Last Post: 05-11-2010, 10:03 PM
  5. How to call methods of different classes
    By adeeb in forum New To Java
    Replies: 2
    Last Post: 06-06-2008, 06:08 AM

Posting Permissions

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