1. Introducing Channels - a new way to chat with other Android users!
    Dismiss Notice

Another ? Why error on this line?


Last Updated:

  1. mojo69

    mojo69 New Member This Topic's Starter

    Joined:
    Nov 29, 2010
    Messages:
    2
    Likes Received:
    0
    setContentView(R.layout.main);

    the editor is telling that main cannot be resolved or is not a field. Here is the full code. There is a main.xml in the layout folder.

    Code (Text):
    1.  
    2.  
    3. [B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]import
    4. [/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2]android.R;[/SIZE]
    5. [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]import[/LEFT]
    6. [/LEFT]
    7. [/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2]android.app.Activity;[/SIZE]
    8. [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]import[/LEFT]
    9. [/LEFT]
    10. [/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2]android.os.Bundle;[/SIZE]
    11.  
    12. [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]import[/LEFT]
    13. [/LEFT]
    14. [/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2]android.content.Intent;[/SIZE]
    15. [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]import[/LEFT]
    16. [/LEFT]
    17. [/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2][U]android.os.Bundle[/U];[/SIZE]
    18. [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]import[/LEFT]
    19. [/LEFT]
    20. [/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2]android.view.View;[/SIZE]
    21. [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]import[/LEFT]
    22. [/LEFT]
    23. [/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2]android.widget.Button;[/SIZE]
    24.  
    25. [LEFT][SIZE=2] [/SIZE]
    26. [B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/LEFT]
    27. [/LEFT]
    28. [/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]class[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] MainActivity [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]extends[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] Activity {[/SIZE]
    29. [LEFT][SIZE=2][COLOR=#3f5fbf][SIZE=2][COLOR=#3f5fbf]/** Called when the activity is first created. */[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f5fbf]
    30. [/COLOR][/SIZE][SIZE=2][COLOR=#646464][SIZE=2][COLOR=#646464]@Override[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#646464]
    31. [/COLOR][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] onCreate(Bundle savedInstanceState) {[/SIZE][/LEFT]
    32.  
    33. [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]super[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2].onCreate(savedInstanceState);[/SIZE]
    34. [SIZE=2]setContentView(R.layout.[U]main[/U]);[/SIZE][/LEFT]
    35.  
    36. [LEFT][SIZE=2]Button next = (Button) findViewById(R.id.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]button1[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]);[/SIZE][/LEFT]
    37.  
    38. [LEFT][SIZE=2]next.setOnClickListener([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] View.OnClickListener() {[/SIZE]
    39. [B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] onClick(View view) {[/SIZE]
    40. [SIZE=2]Intent myIntent = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] Intent(view.getContext(), DropOff.[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]class[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]);[/SIZE]
    41. [SIZE=2]startActivityForResult(myIntent, 0);[/SIZE]
    42. [SIZE=2]}[/SIZE][/LEFT]
    43.  
    44. [LEFT][SIZE=2]});[/SIZE][/LEFT]
    45.  
    46.  
    47. [LEFT][SIZE=2]}[/SIZE][/LEFT]
    48. [SIZE=2][COLOR=#3f5fbf]
    49. [/COLOR][/SIZE]
    50. [SIZE=2]}[/SIZE]
    51.  
    52.  
    [/LEFT]
     

    Advertisement

Share This Page

Loading...