Fragment Layout Name


#1

I’m trying to go through the first application but eclipse keeps creating a fragment layout which make the project different than the book. Has anyone else had this issue?


#2

You might have an automatic checkmark selected or an automatic class type before you create the class
Check for that. Not sure where but I know there is something there. Sometimes even just restart eclipse and your computer

I’m having trouble on page 41 where it says to organize the damn functions. I tried but it keeps giving me an @enum error. I shouldn’t need an enum and I know I have to separate two functions but where do I separate them exactly.

Hit me up if you want to bounce ideas off each other. I’m new to Android Dev. kinda, maybe we can help each other out.

One other thing, you will need fragments later but don’t do it at this step. This literally teaches you the absolute fundamentals which we should go through step by step.

Riz


#3

Found a solution here: stackoverflow.com/questions/2228 … t-activity

"

For those who would like instructions on how to remove Fragments from the project:

  1. Copy all the contents of res/layout/fragment_main.xml. Open activity_main.xml, delete the FrameLayout, and paste in the copied contents.

  2. Delete fragment_main.xml

  3. In MainActivity.java, delete the whole PlaceHolderFragment class:

/**

  • A placeholder fragment containing a simple view.
    */
    public static class PlaceholderFragment extends Fragment {

    public PlaceholderFragment() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
    Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_main,
    container, false);
    return rootView;
    }
    }

  1. Delete the following lines from onCreate():

if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment()).commit();
}

At this point you should be all set to run the project.
"


#4

EDIT: Removed post because of inaccurate information.


#5

Thanks for the help everyone!

Pajos83 your solution did the trick.

zigzigsolutions I will definitely contact you if I run into anymore issues.


#6

Using ADT 22.6.3 you can get the old behavior without fragments by creating an “Emtpy Activity” rather than a “Blank Activity”