Note that there are some explanatory texts on larger screens.

plurals
  1. POdivide layout for two parts, analog clock and a listview. android
    text
    copied!<p>I want to divide layout for two parts in first I will have only an analog clock, in the second I wanto to have a listview. </p> <p>xml file ; </p> <pre><code>&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;AnalogClock android:id="@+id/analogClock1" android:layout_width="match_parent" android:layout_height="wrap_content" /&gt; &lt;include android:layout_width="match_parent" android:layout_height="match_parent" layout="@layout/day_plan" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>xml of the including layout ; </p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/countryTextView" android:layout_width="fill_parent" android:layout_height="wrap_content" android:padding="8dp" android:textSize="20sp" android:textColor="@android:color/white" android:minHeight="?android:attr/listPreferredItemHeight" android:gravity="center_vertical"/&gt; </code></pre> <p>I want to display under this clock a list with my events from database: </p> <pre><code>public class Clock extends ListActivity { public static final String ROW_ID = "row_id"; private ListView conListView; private CursorAdapter conAdapter; public String opis; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.morning_clock); conListView=getListView(); conListView.setOnItemClickListener(viewConListener); AnalogClock ac = (AnalogClock) findViewById(R.id.analogClock1); // map each name to a TextView String[] from = new String[] { "event" }; int[] to = new int[] { R.id.countryTextView }; conAdapter = new SimpleCursorAdapter(Clock.this, R.layout.morning_clock, null, from, to); setListAdapter(conAdapter); // set adapter } @Override protected void onResume() { super.onResume(); new GetEvents().execute((Object[]) null); } @Override protected void onStop() { Cursor cursor = conAdapter.getCursor(); if (cursor != null) cursor.deactivate(); conAdapter.changeCursor(null); super.onStop(); } private class GetEvents extends AsyncTask&lt;Object, Object, Cursor&gt; { DatabaseConnector dbConnector = new DatabaseConnector(Clock.this); @Override protected Cursor doInBackground(Object... params) { Intent a = getIntent(); String d_m_y = a.getStringExtra("d_m_y"); dbConnector.open(); return dbConnector.getdate(d_m_y); } @Override protected void onPostExecute(Cursor result) { conAdapter.changeCursor(result); // set the adapter's Cursor dbConnector.close(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.dayplan_menu, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { Intent addEvent = new Intent(Clock.this, AddEvent.class); startActivity(addEvent); return super.onOptionsItemSelected(item); } OnItemClickListener viewConListener = new OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2,long arg3) { Intent viewEvent = new Intent(Clock.this, ViewEvent.class); viewEvent.putExtra(ROW_ID, arg3); startActivity(viewEvent); } }; } </code></pre> <p>and Im getting errors : </p> <pre><code> 01-02 21:57:50.645: E/AndroidRuntime(1047): FATAL EXCEPTION: main 01-02 21:57:50.645: E/AndroidRuntime(1047): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.examples.android.calendar/com.examples.android.calendar.Clock}: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list' 01-02 21:57:50.645: E/AndroidRuntime(1047): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059) 01-02 21:57:50.645: E/AndroidRuntime(1047): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 01-02 21:57:50.645: E/AndroidRuntime(1047): at android.app.ActivityThread.access$600(ActivityThread.java:130) 01-02 21:57:50.645: E/AndroidRuntime(1047): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 01-02 21:57:50.645: E/AndroidRuntime(1047): at android.os.Handler.dispatchMessage(Handler.java:99) 01-02 21:57:50.645: E/AndroidRuntime(1047): at android.os.Looper.loop(Looper.java:137) 01-02 21:57:50.645: E/AndroidRuntime(1047): at android.app.ActivityThread.main(ActivityThread.java:4745) 01-02 21:57:50.645: E/AndroidRuntime(1047): at java.lang.reflect.Method.invokeNative(Native Method) 01-02 21:57:50.645: E/AndroidRuntime(1047): at java.lang.reflect.Method.invoke(Method.java:511) 01-02 21:57:50.645: E/AndroidRuntime(1047): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 01-02 21:57:50.645: E/AndroidRuntime(1047): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 01-02 21:57:50.645: E/AndroidRuntime(1047): at dalvik.system.NativeStart.main(Native Method) </code></pre>
 

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