Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

Hi i want to add a dashboard above my menu list, i did it but when i test it on AVD the dashboard is looping for each menu

this is my code

fard.java:

public class Fard extends ListActivity 
{


public void onCreate(Bundle savedInstanceState) 
{
super.onCreate(savedInstanceState);


// storing string resources into Array
String[] fard_list = getResources().getStringArray(R.array.fardhu_list);

// Binding resources Array to ListAdapter
this.setListAdapter(new ArrayAdapter<String>(this, R.layout.fard_item, R.id.label, fard_list));
ListView lv = getListView();

// listening to single list item on click
lv.setOnItemClickListener(new OnItemClickListener() {
  public void onItemClick(AdapterView<?> parent, View view,
      int position, long id) {

      // selected item 
      String product = ((TextView) view).getText().toString();

      // Launching new Activity on selecting single List Item
      Intent i = new Intent(getApplicationContext(), SingleListItem.class);
      // sending data to new activity
      i.putExtra("product", product);
      startActivity(i);

  }
});
}

} // end class

fardu_list.xml (values)

<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="fardhu_list">
    <item>Subuh</item>
    <item>Dzuhur</item>
    <item>Ashar</item>
    <item>Maghrib</item>
    <item>Isya</item>
    <item>Jum at</item>
</string-array>
</resources>

fard_item.xml (layout)

<?xml version="1.0" encoding="utf-8"?>
<!--  Single List Item Design -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<LinearLayout style="@style/TitleBar">
    <ImageButton style="@style/TitleBarAction"
        android:contentDescription="@string/description_home"
        android:src="@drawable/title_home"
        android:onClick="onClickHome" />

    <ImageView style="@style/TitleBarSeparator" />
    <TextView style="@style/TitleBarText" />
    <ImageButton style="@style/TitleBarAction"
        android:contentDescription="@string/description_about"
        android:src="@drawable/title_about"
        android:onClick="onClickAbout" />
    <!-- ImageButton style="@style/TitleBarAction"
        android:contentDescription="@string/description_search"
        android:src="@drawable/title_search"
        android:onClick="onClickSearch" /> -->
</LinearLayout>
<TextView 
android:id="@+id/label"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:padding="10dip"
    android:textSize="16dip"
    android:textStyle="bold" >

</TextView>
</LinearLayout>

I know the problem may be on the in the fard_item.xml I have tried to modify (layout) in a variety of ways but still have not found the right way , how can i make the dashboard not looping?

PS: i still noob.

share|improve this question
    
what do u mean by dashboard? –  amalBit Jun 22 '13 at 6:35
    
it's like header where we can place home button, logo, etc. –  dzul Jun 22 '13 at 6:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.