Droid Code Fix

Discussion in 'Android Hacks and Help' started by Null Pointer, Mar 22, 2010.

  1. Null Pointer
    Offline

    Null Pointer New Member

    Joined:
    Mar 14, 2010
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    steven.ireland@live.com
    I just started developing droif apps, but nothing will display, even though the dev center says IT WILL. can you guys take a look? I know the code may be disgusting.... but if you can help me..

    publicvoid onCreate(Bundle savedInstanceState) {
    System.out.println("Hallo"); // Things like this were for tests--none fired
    super.onCreate(savedInstanceState);
    Button button = new Button (this);
    button.setText(" Click me! ");
    button.setBackgroundColor(8);
    button.setWidth(50);
    button.setHeight(50);
    button.setOnClickListener(new View.OnClickListener() {
    publicvoid onClick(View v) {
    System.out.println("Here!");
    }
    });
    setContentView(button);


    After all that (No errors), I still got only the blank android emulator diplaying "ANDROID". Any suggestions? I'm a newbie to Droid structure..


    EDIT: It IS "public void", not "publicvoid"
  2. Samstag
    Offline

    Samstag New Member

    Joined:
    Jan 31, 2010
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    0
    You need to define an Activity to get anything to display in Android. Take a look at the hello world tutorial to get started.
  3. mjones1052
    Offline

    mjones1052 New Member

    Joined:
    Dec 21, 2009
    Messages:
    343
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Philly
    I don't think publicvoid should be one word should it?

    NVM mind saw your edit
  4. Null Pointer
    Offline

    Null Pointer New Member

    Joined:
    Mar 14, 2010
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    steven.ireland@live.com
    That was just some.. Here is all the code:

    package​
    com.steve.personal;

    import​
    android.app.Activity;

    import​
    android.os.Bundle;

    import​
    android.view.View;

    import​
    android.widget.Button;

    public​
    class App1 extends Activity {



    public void onCreate(Bundle savedInstanceState) {
    System.
    out.println("Hallo");
    super.onCreate(savedInstanceState);
    Button button =
    new Button (this);
    button.setText(
    " Click me! ");
    button.setBackgroundColor(8);
    button.setWidth(50);
    button.setHeight(50);
    button.setOnClickListener(
    new View.OnClickListener() {
    public void onClick(View v) {
    System.
    out.println("Here!");
    }
    });
    setContentView(button);


    }

    }


    I just modified the Hello World tutorial (Which also did nothing)
  5. Samstag
    Offline

    Samstag New Member

    Joined:
    Jan 31, 2010
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    0
    If the hello world tutorial didn't work, then you've got a problem with your installation. You might want to go through the whole tutorial again and be careful about setting everything up exactly as directed.
  6. Null Pointer
    Offline

    Null Pointer New Member

    Joined:
    Mar 14, 2010
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    steven.ireland@live.com
    Could you try it out and tell me what happens?
  7. jnev
    Offline

    jnev New Member

    Joined:
    Nov 10, 2009
    Messages:
    63
    Likes Received:
    0
    Trophy Points:
    0
    you need to create an xml file in res/layout/ that will define the look of your app. you cannot make system calls to print; rather everything you display is created through the xml file. creating a Button object does not automatically display it on the screen. for example, you never call setContentView() to dispaly your activity.

    go through some basic android development tutorials and it will show you the layout of an android project.
Search tags for this page
cause code 255 error class 3
,
cause code 98
,
cause code 98 error class 2 verizon
,
cause code 98 error class 3
,

cause code 98 error class 3 verizon

,
droid eris sms error cause code 255 error class 3
,
how to fix cause code 98
,

sms error cause code 255 error class 3

,
verizon cause code 98 error class 2
,
verizon cause code 98 error class 3
,
verizon error code 98
,
verizon error code null