DroidForums.net is the original Verizon Android Forum! Registered Users do not see these ads. Please Register - It's Free!
Results 1 to 7 of 7

Thread: Droid Code Fix

  1. Junior Droid
    Null Pointer's Avatar
    Member #
    47087
    Join Date
    Mar 2010
    Location
    steven.ireland@live.com
    Posts
    7
    Phone
    What's it to 'ya?
    #1

    Droid Code Fix

    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"
    Last edited by Null Pointer; 03-22-2010 at 06:57 PM.
  2. Droid
    Samstag's Avatar
    Member #
    33274
    Join Date
    Jan 2010
    Posts
    34
    Phone
    Droid A855
    #2
    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. Master Droid
    mjones1052's Avatar
    Member #
    18034
    Join Date
    Dec 2009
    Location
    Philly
    Posts
    343
    Phone
    Moto Droid
    #3
    I don't think publicvoid should be one word should it?

    NVM mind saw your edit
  4. Junior Droid
    Null Pointer's Avatar
    Member #
    47087
    Join Date
    Mar 2010
    Location
    steven.ireland@live.com
    Posts
    7
    Phone
    What's it to 'ya?
    #4
    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 {



    publicvoid 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() {
    publicvoid onClick(View v) {
    System.
    out.println("Here!");
    }
    });
    setContentView(button);


    }

    }


    I just modified the Hello World tutorial (Which also did nothing)
  5. Droid
    Samstag's Avatar
    Member #
    33274
    Join Date
    Jan 2010
    Posts
    34
    Phone
    Droid A855
    #5
    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. Junior Droid
    Null Pointer's Avatar
    Member #
    47087
    Join Date
    Mar 2010
    Location
    steven.ireland@live.com
    Posts
    7
    Phone
    What's it to 'ya?
    #6
    Could you try it out and tell me what happens?
  7. Droid
    jnev's Avatar
    Member #
    2652
    Join Date
    Nov 2009
    Posts
    63
    Phone
    Droid
    #7
    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.

Links

Posting Permissions

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

Similar Threads

  1. QR Code Tip
    By mivok in forum Android General Discussions
    Replies: 5
    Last Post: 10-15-2012, 09:12 AM
  2. Lock my droid using numeric lock code?
    By kat13dawg in forum Android Applications
    Replies: 4
    Last Post: 03-28-2010, 01:33 PM
  3. Droid makes faint beeping alomost like morse code
    By ibanfly in forum Android Tech Support
    Replies: 5
    Last Post: 02-20-2010, 09:07 PM
  4. Droid ERIS source code released
    By RinTinTigger in forum Android News
    Replies: 3
    Last Post: 02-03-2010, 09:47 AM

Search tags for this page

cause code 255 error class 3
,
cause code 98
,
cause code 98 error class 3
,

cause code 98 error class 3 verizon

,
sms error 255 error class 3
,

sms error cause code 255 error class 3

,
sms error cause code 34 error class 2
,
verizon cause code 98 error class 2
,
verizon cause code 98 error class 3
,
verizon sms error 255
Click on a term to search our site for related topics.
Find us on Google+