Note that there are some explanatory texts on larger screens.

plurals
  1. POSource Not Found main.xml Eclipse
    primarykey
    data
    text
    <p>Im a beginner to android developing and have run into a problem. Im making a simple app that displays presidents in a List View. But when I try to run it on the emulator, ir gets this error: Source not Found net.learn2develop.Listfragmentexample.ListFragmentExampleActivity. Here is my code for the java file:</p> <pre><code>package net.learn2develop.Listfragmentexample; import android.app.ListFragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Toast; public class Fragment1 extends ListFragment { String[] presidents = { "Dwight D. Eisenhower", "John F. Kennedy", "Lyndon B. Johnson", "Richard Nixon", "Gerald Ford", "Jimmy Carter", "Ronald Reagen", "George H. W. Bush", "Bill Clinton", "George W. Bush", "Barack Obama" }; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment1, container, false); } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setListAdapter(new ArrayAdapter&lt;String&gt;(getActivity(), android.R.layout.simple_list_item_1, presidents)); } public void onListItemClick(ListView parent, View v, int position, long id) { Toast.makeText(getActivity(), "You have selected item : " + presidents[position], Toast.LENGTH_SHORT).show(); } } </code></pre> <p>Here is the code for the main.xml:</p> <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" &gt; &lt;fragment android:id="@+id/fragment1" android:name="net.learn2develop.ListFragmentExample.Fragment1" android:layout_weight="0.5" android:layout_width="0dp" android:layout_height="200dp" /&gt; &lt;fragment android:id="@+id/fragment2" android:name="net.learn2develop.ListFragmentExample.Fragment1" android:layout_weight="0.5" android:layout_width="0dp" android:layout_height="300dp" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>And here is the code for fragment1.xml:</p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" &gt; &lt;ListView android:id="@id/android:list" android:layout_weight="1" android:layout_width="match_parent" android:layout_height="match_parent" android:drawSelectorOnTop="false"/&gt; &lt;/LinearLayout&gt; </code></pre> <p>Here is my Logcat trace:</p> <pre><code>[2013-04-25 18:31:55 - ListFragmentExample] Android Launch! [2013-04-25 18:31:55 - ListFragmentExample] adb is running normally. [2013-04-25 18:31:55 - ListFragmentExample] Performing net.learn2develop.Listfragmentexample.ListFragmentExampleActivity activity launch [2013-04-25 18:31:55 - ListFragmentExample] Automatic Target Mode: using existing emulator 'emulator-5554' running compatible AVD 'Android_4.0' [2013-04-25 18:31:55 - ListFragmentExample] Uploading ListFragmentExample.apk onto device 'emulator-5554' [2013-04-25 18:31:56 - ListFragmentExample] Installing ListFragmentExample.apk... [2013-04-25 18:32:03 - ListFragmentExample] Success! [2013-04-25 18:32:03 - ListFragmentExample] Starting activity net.learn2develop.Listfragmentexample.ListFragmentExampleActivity on device emulator-5554 [2013-04-25 18:32:05 - ListFragmentExample] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=net.learn2develop.Listfragmentexample/.ListFragmentExampleActivity } [2013-04-25 18:32:06 - ListFragmentExample] Attempting to connect debugger to 'net.learn2develop.Listfragmentexample' on port 8666 </code></pre> <p>Here is my Manifest code:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="net.learn2develop.Listfragmentexample" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="14" android:targetSdkVersion="14" /&gt; &lt;application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" &gt; &lt;activity android:name="net.learn2develop.Listfragmentexample.ListFragmentExampleActivity" android:label="@string/app_name" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;/application&gt; &lt;/manifest&gt; </code></pre> <p>Can someone fill me in here? I dont know what im doing wrong. Any help is much appreciated!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload