Thursday, May 2, 2013

[android help] Source Not Found Error Beginning Android 4 Application Development by Wei-Meng Lee, Eclipse REPOST


THIS IS A RE-POST. I VERY MUCH NEED HELP! I am a Android beginner going through a book right now thats teaching me android called Android 4 Application Development by We-Meng Lee. I am making a project that uses a preference fragment. However. When I try to run it, It takes me to a screen back in eclipse that says "Source Not found "cmp=net.learn2develop.PreferenceFragmentExample/.PreferenceFragmentExampleActivity Here is my code for preferences.xml.




xmlns:android="http://schemas.android.com/apk/res/android" >


android:title="Checkbox"
android:defaultValue="false"
android:summary="True of False"
android:key="checkboxPref" />



android:name="EditText"
android:summary="Enter A string"
android:defaultValue="[Enter a string here]"
android:title="Edit Text"
android:key="editTextPref" />
android:name="Ringtone Preference"
android:summary="Select a Ringtone"
android:title="Ringtones"
android:key="ringtonePref" />
android:title="Second Preference Screen"
android:summary="Click Here To Go To The Second Preference Screen"
android:key="secondPrefScreenPref" />
android:name="EditText"
android:summary="Enter A string"
android:title="Edit Text (second Screen)"
android:key="secondEditTextPref" />



Here is my code for my Fragment1.java file.



package net.learn2develop.PreferenceFragmentExample;

import android.os.Bundle;
import android.preference.PreferenceFragment;

public class Fragment1 extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

addPreferencesFromResource(R.xml.preferences);
}

}


And here is my PreferenceExampleActivity.java file



package net.learn2develop.PreferenceFragmentExample;

import android.app.Activity;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.os.Bundle;

public class PreferenceFragmentExampleActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction =
fragmentManager.beginTransaction();
Fragment1 fragment1 = new Fragment1();
fragmentTransaction.replace(android.R.id.content, fragment1);
fragmentTransaction.addToBackStack(null);
fragmentTransaction.commit();
}
}


Can someone enlighten me on why this is doing this? Any help is greatly appreciated!



.

stackoverflow.comm

No comments:

Post a Comment

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...