How to set non clickable Header for Listview

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

How to set non clickable Header for Listview

Postby nbagade » Wed Dec 30, 2009 5:33 am

Hi,

I have to two screen ,in both screen I am displaying Listview.
Now after clicking on first item of 1st listview screen the corresponding second listview screen should be
display with the click item of first screen should be Header for the second screen.the header should be non clickable.

How to achieve it.Can someone help me?

Thanks in advance.
Neo
nbagade
Experienced Developer
Experienced Developer
 
Posts: 58
Joined: Fri Nov 20, 2009 7:49 am
Location: India

Top

Postby achie1266 » Wed Dec 30, 2009 6:47 am

It can be done in two ways.

1. In the second listView use the addHeaderView method on the ListView from your 2nd listActivity.

2. Add the header like a textview or a linear layout or whatever layout/widget in the layout for the 2nd listView itself, This way it will not even be scrollable even when the list scrolls and it always stays on top.
achie
User avatar
achie1266
Master Developer
Master Developer
 
Posts: 223
Joined: Mon Nov 09, 2009 10:56 pm
Location: Denver

Postby nbagade » Wed Dec 30, 2009 7:06 am

I have uesed addHeaderView() method ,but that header is scrollable and clickable,

My code for that lis is like,
package com.Foodies;

import android.app.ListActivity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ListView;

import android.widget.TextView;


public class IStarter extends ListActivity {

private static class EfficientAdapter extends BaseAdapter{
private LayoutInflater mInflater;
private Bitmap mIcon1;
private Bitmap mIcon2;
private Bitmap mIcon3;
private Bitmap mIcon4;
private Bitmap mIcon5;
private Bitmap mIcon6;

private Bitmap mIcon7;
private Bitmap mIcon8;
private Bitmap mIcon9;
private Bitmap mIcon10;
private Bitmap mIcon11;
private Bitmap mIcon12;

public EfficientAdapter(Context context) {
// Cache the LayoutInflate to avoid asking for a new one each time.
mInflater = LayoutInflater.from(context);

// Icons bound to the rows.
mIcon1 = BitmapFactory.decodeResource(context.getResources(), R.drawable.starter);
mIcon2 = BitmapFactory.decodeResource(context.getResources(), R.drawable.soups);
mIcon3 = BitmapFactory.decodeResource(context.getResources(), R.drawable.vegetablr);
mIcon4 = BitmapFactory.decodeResource(context.getResources(), R.drawable.dals);
mIcon5 = BitmapFactory.decodeResource(context.getResources(), R.drawable.mutton);
mIcon6 = BitmapFactory.decodeResource(context.getResources(), R.drawable.rice);

mIcon7 = BitmapFactory.decodeResource(context.getResources(), R.drawable.starter);
mIcon8 = BitmapFactory.decodeResource(context.getResources(), R.drawable.soups);
mIcon9 = BitmapFactory.decodeResource(context.getResources(), R.drawable.vegetablr);
mIcon10 = BitmapFactory.decodeResource(context.getResources(), R.drawable.dals);
mIcon11 = BitmapFactory.decodeResource(context.getResources(), R.drawable.mutton);
mIcon12= BitmapFactory.decodeResource(context.getResources(), R.drawable.rice);
}
public int getCount() {
return DATA.length;
}
public Object getItem(int position) {
return position;
}
public long getItemId(int position) {
return position;
}
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;


if (convertView == null) {
convertView = mInflater.inflate(R.layout.indian_recipes, null);
holder = new ViewHolder();
holder.text = (TextView) convertView.findViewById(R.id.textview01);
holder.icon = (ImageView) convertView.findViewById(R.id.ImageView01);
convertView.setTag(holder);
}
else
{
holder = (ViewHolder) convertView.getTag();
}

holder.text.setText(DATA[position]);


//holder.icon.setImageBitmap((position & 1) == 1 ? mIcon1 : mIcon2);
switch (position)
{
case 0:
holder.icon.setImageBitmap(mIcon1 );
break;
case 1:
holder.icon.setImageBitmap(mIcon2 );
break;
case 2:
holder.icon.setImageBitmap(mIcon3 );
break;
case 3:
holder.icon.setImageBitmap(mIcon4 );
break;
case 4:
holder.icon.setImageBitmap(mIcon5 );
break;
case 5:
holder.icon.setImageBitmap(mIcon6 );
break;

case 6:
holder.icon.setImageBitmap(mIcon7 );
break;
case 7:
holder.icon.setImageBitmap(mIcon8 );
break;
case 8:
holder.icon.setImageBitmap(mIcon9 );
break;
case 9:
holder.icon.setImageBitmap(mIcon10 );
break;
case 10:
holder.icon.setImageBitmap(mIcon11 );
break;
case 11:
holder.icon.setImageBitmap(mIcon12 );
break;
}

return convertView;
}
static class ViewHolder {
TextView text;
ImageView icon;

}
}



private static final String[] DATA ={" Vegetable Samosa", " Cabbage Sabudana Vada"," Khaman Dhokla"," Cabbage Idli",
" Amritsari Fish"," Vegetable Pakora"," Chicken Pakora"," Tandori Chicken"," Aloo Keema Tikka"," Gobi Pakora"," Sabudana Vada"," Tangy Paneer Chilli"};

protected void onListItemClick(ListView l, View v, int position, long id) {

// TODO Auto-generated method stub
super.onListItemClick(l, v, position, id);
Intent intent = new Intent();
Bundle bundle = new Bundle();
bundle.putString("country", l.getItemAtPosition(position).toString());
intent.putExtras(bundle);
setResult(RESULT_OK, intent);
finish();
}

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getListView().setCacheColorHint(1);
getListView().setBackgroundResource(R.drawable.ihome);

getListView().setPadding(10,85, 0, 0);
getListView().getPaddingTop();
TextView th= new TextView(this);//===================================//
th.setText("Starter");//===========================================//
getListView().addHeaderView(th);//==================================//
setListAdapter(new EfficientAdapter(this));

}

}

and my layout file is,
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content">

<ImageView android:id="@+id/ImageView01"
android:layout_width="56px"
android:paddingLeft="2px"
android:paddingRight="2px"
android:paddingTop="2px"
android:layout_height="wrap_content"
>
</ImageView>
<TextView
android:id="@+id/textview01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textColor="@color/opaque_green"
android:paddingRight="4px"
/>
</LinearLayout>

Please tell me where am I wrong?
nbagade
Experienced Developer
Experienced Developer
 
Posts: 58
Joined: Fri Nov 20, 2009 7:49 am
Location: India

Postby achie1266 » Wed Dec 30, 2009 7:30 am

Like I said addHeaderView adds it as a header which is scrollable.
I never tested if the headerView added using addheaderview method is clickable or not. Try setting clickable = false.
I would just use the second approach rather than following all this as it will also let you customize it in a better way.

BTW please use code hinting when posting here. that will help us better understand your code by making it more readable.
like this
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. ......................
Parsed in 0.039 seconds, using GeSHi 1.0.8.4
Sorry but I did not go thru ur code as it is too lengthy to read and search for what is relevant. Please edit your post using the tags available to highlist the java/xml/code regions
achie
User avatar
achie1266
Master Developer
Master Developer
 
Posts: 223
Joined: Mon Nov 09, 2009 10:56 pm
Location: Denver

Postby nbagade » Wed Dec 30, 2009 7:37 am

how to use second approach?
nbagade
Experienced Developer
Experienced Developer
 
Posts: 58
Joined: Fri Nov 20, 2009 7:49 am
Location: India

Postby achie1266 » Wed Dec 30, 2009 7:40 am

Add a textview or a linear layout or whatever layout/widget in the layout for the 2nd listView itself, This way it will not even be scrollable even when the list scrolls and it always stays on top.
achie
User avatar
achie1266
Master Developer
Master Developer
 
Posts: 223
Joined: Mon Nov 09, 2009 10:56 pm
Location: Denver

Top

Postby nbagade » Wed Dec 30, 2009 7:57 am

I am not getting how to put in my code,
please give the example or skeleton of code
nbagade
Experienced Developer
Experienced Developer
 
Posts: 58
Joined: Fri Nov 20, 2009 7:49 am
Location: India

Postby achie1266 » Wed Dec 30, 2009 8:49 am

hmm ok, will do it.

just post your xml layout file where your second listView is and I will make the changes and will also let you know what to do from your java code.
And this time please use code highlighting when you post your code.
And if you dont mind please be quick as I will be going to bed soon.
achie
User avatar
achie1266
Master Developer
Master Developer
 
Posts: 223
Joined: Mon Nov 09, 2009 10:56 pm
Location: Denver

Postby nbagade » Wed Dec 30, 2009 9:03 am

my xml file is like,[syntax="xml"]
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content">

<ImageView android:id="@+id/ImageView01"
android:layout_width="56px"
android:paddingLeft="2px"
android:paddingRight="2px"
android:paddingTop="2px"
android:layout_height="wrap_content"
>
</ImageView>
<TextView
android:id="@+id/textview01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textColor="@color/opaque_green"
android:paddingRight="4px"
/>
</LinearLayout>
nbagade
Experienced Developer
Experienced Developer
 
Posts: 58
Joined: Fri Nov 20, 2009 7:49 am
Location: India

Postby achie1266 » Wed Dec 30, 2009 9:11 am

hmm good that you tried to use code highlighting. you need to click the xml button after finishing your xml file also. It will only then close the tag and show it as code.

Anyway coming to our discussion, i donot see a ListView in that layout.
I think that you have posted the layout of your ListItem and not the ListView. So can you post the layout of that one.
achie
User avatar
achie1266
Master Developer
Master Developer
 
Posts: 223
Joined: Mon Nov 09, 2009 10:56 pm
Location: Denver

Postby nbagade » Wed Dec 30, 2009 9:11 am

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.  
  2. <?xml version="1.0" encoding="utf-8"?>
  3.  
  4. <LinearLayout
  5.  
  6.  xmlns:android="http://schemas.android.com/apk/res/android"
  7.  
  8.  android:layout_width="fill_parent"
  9.  
  10.  android:layout_height="wrap_content">
  11.  
  12.  
  13.  
  14.   <ImageView android:id="@+id/ImageView01"
  15.  
  16.         android:layout_width="56px"  
  17.  
  18.    android:paddingLeft="2px"  
  19.  
  20.    android:paddingRight="2px"  
  21.  
  22.    android:paddingTop="2px"  
  23.  
  24.    android:layout_height="wrap_content"  
  25.  
  26.         >
  27.  
  28. </ImageView>
  29.  
  30. <TextView  
  31.  
  32.         android:id="@+id/textview01"
  33.  
  34.    android:layout_width="fill_parent"
  35.  
  36.    android:layout_height="wrap_content"
  37.  
  38.    android:textStyle="bold"
  39.  
  40.    android:textColor="@color/opaque_green"      
  41.  
  42.    android:paddingRight="4px"  
  43.  
  44.    />  
  45.  
  46.     </LinearLayout>
  47.  
  48.  
Parsed in 0.003 seconds, using GeSHi 1.0.8.4
nbagade
Experienced Developer
Experienced Developer
 
Posts: 58
Joined: Fri Nov 20, 2009 7:49 am
Location: India

Postby achie1266 » Wed Dec 30, 2009 9:16 am

anyway here it is, This is how you need to do. There are other ways too but this will be a simple approach when you have just a textView.
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="UTF-8"?>
  2.  
  3. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  4.  
  5.                 android:id="@+id/main_list"
  6.  
  7.         android:layout_width="fill_parent"
  8.  
  9.         android:layout_height="fill_parent"
  10.  
  11.         android:orientation="vertical"
  12.  
  13.         android:padding="5dip" >
  14.  
  15.    
  16.  
  17.           <TextView android:id="@+id/text"
  18.  
  19.                 android:layout_width="fill_parent"
  20.  
  21.                 android:layout_height="wrap_content"
  22.  
  23.                 android:text="@string/no_symptoms"/>
  24.  
  25.  
  26.  
  27.           <ListView android:id="@+id/list"
  28.  
  29.                 android:layout_width="fill_parent"
  30.  
  31.                 android:layout_height="wrap_content"
  32.  
  33.                 android:layout_weight="1.0" />
  34.  
  35.  
  36.  
  37. </LinearLayout>
Parsed in 0.003 seconds, using GeSHi 1.0.8.4
Now you just call the textView from your java code and set its text using the setText method.
hope it helps
achie
User avatar
achie1266
Master Developer
Master Developer
 
Posts: 223
Joined: Mon Nov 09, 2009 10:56 pm
Location: Denver

Postby achie1266 » Wed Dec 30, 2009 9:19 am

nbagade wrote:
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <LinearLayout
  3.  xmlns:android="http://schemas.android.com/apk/res/android"
  4.  android:layout_width="fill_parent"
  5.  android:layout_height="wrap_content">
  6.  
  7.   <ImageView android:id="@+id/ImageView01"
  8.         android:layout_width="56px"  
  9.    android:paddingLeft="2px"  
  10.    android:paddingRight="2px"  
  11.    android:paddingTop="2px"  
  12.    android:layout_height="wrap_content"  
  13.         >
  14. </ImageView>
  15. <TextView  
  16.         android:id="@+id/textview01"
  17.    android:layout_width="fill_parent"
  18.    android:layout_height="wrap_content"
  19.    android:textStyle="bold"
  20.    android:textColor="@color/opaque_green"      
  21.    android:paddingRight="4px"  
  22.    />  
  23.     </LinearLayout>
  24.  
Parsed in 0.003 seconds, using GeSHi 1.0.8.4
This is not the layout of your ListView. please check my code. that should help you anyway, so try doing it that way. If you still think its difficult, please post the layout file and the java code and i will make the necessary changes.

Will check back tomorrow morning.
Last edited by achie1266 on Wed Dec 30, 2009 9:20 am, edited 1 time in total.
achie
User avatar
achie1266
Master Developer
Master Developer
 
Posts: 223
Joined: Mon Nov 09, 2009 10:56 pm
Location: Denver

Postby nbagade » Wed Dec 30, 2009 9:20 am

Hi this is my layout.

I am displaying this imageView and TextView in the ListView using Java code.
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. package com.Foodies;
  3.  
  4.  
  5.  
  6. import android.app.ListActivity;
  7.  
  8. import android.content.Context;
  9.  
  10. import android.content.Intent;
  11.  
  12. import android.graphics.Bitmap;
  13.  
  14. import android.graphics.BitmapFactory;
  15.  
  16. import android.os.Bundle;
  17.  
  18. import android.view.LayoutInflater;
  19.  
  20. import android.view.View;
  21.  
  22. import android.view.ViewGroup;
  23.  
  24. import android.widget.BaseAdapter;
  25.  
  26. import android.widget.ImageView;
  27.  
  28. import android.widget.ListView;
  29.  
  30.  
  31.  
  32. import android.widget.TextView;
  33.  
  34.  
  35.  
  36.  
  37.  
  38. public class IStarter extends ListActivity {
  39.  
  40.        
  41.  
  42.         private static class EfficientAdapter extends BaseAdapter{
  43.  
  44.                 private LayoutInflater mInflater;  
  45.  
  46.                 private Bitmap mIcon1;      
  47.  
  48.                 private Bitmap mIcon2;
  49.  
  50.                 private Bitmap mIcon3;      
  51.  
  52.                 private Bitmap mIcon4;
  53.  
  54.                 private Bitmap mIcon5;      
  55.  
  56.                 private Bitmap mIcon6;
  57.  
  58.                
  59.  
  60.                 private Bitmap mIcon7;      
  61.  
  62.                 private Bitmap mIcon8;
  63.  
  64.                 private Bitmap mIcon9;      
  65.  
  66.                 private Bitmap mIcon10;
  67.  
  68.                 private Bitmap mIcon11;      
  69.  
  70.                 private Bitmap mIcon12;
  71.  
  72.                
  73.  
  74.                  public EfficientAdapter(Context context) {  
  75.  
  76.                          // Cache the LayoutInflate to avoid asking for a new one each time.
  77.  
  78.                          mInflater = LayoutInflater.from(context);  
  79.  
  80.                          
  81.  
  82.                          // Icons bound to the rows.          
  83.  
  84.                          mIcon1 = BitmapFactory.decodeResource(context.getResources(), R.drawable.starter);  
  85.  
  86.                          mIcon2 = BitmapFactory.decodeResource(context.getResources(), R.drawable.soups);  
  87.  
  88.                          mIcon3 = BitmapFactory.decodeResource(context.getResources(), R.drawable.vegetablr);  
  89.  
  90.                          mIcon4 = BitmapFactory.decodeResource(context.getResources(), R.drawable.dals);
  91.  
  92.                          mIcon5 = BitmapFactory.decodeResource(context.getResources(), R.drawable.mutton);  
  93.  
  94.                          mIcon6 = BitmapFactory.decodeResource(context.getResources(), R.drawable.rice);
  95.  
  96.                          
  97.  
  98.                          mIcon7 = BitmapFactory.decodeResource(context.getResources(), R.drawable.starter);  
  99.  
  100.                          mIcon8 = BitmapFactory.decodeResource(context.getResources(), R.drawable.soups);  
  101.  
  102.                          mIcon9 = BitmapFactory.decodeResource(context.getResources(), R.drawable.vegetablr);  
  103.  
  104.                          mIcon10 = BitmapFactory.decodeResource(context.getResources(), R.drawable.dals);
  105.  
  106.                          mIcon11 = BitmapFactory.decodeResource(context.getResources(), R.drawable.mutton);  
  107.  
  108.                          mIcon12= BitmapFactory.decodeResource(context.getResources(), R.drawable.rice);
  109.  
  110.                  }
  111.  
  112.                  public int getCount() {    
  113.  
  114.                          return DATA.length;    
  115.  
  116.                          }
  117.  
  118.                  public Object getItem(int position) {
  119.  
  120.                          return position;    
  121.  
  122.                          }
  123.  
  124.                  public long getItemId(int position) {
  125.  
  126.                          return position;    
  127.  
  128.                          }
  129.  
  130.                  public View getView(int position, View convertView, ViewGroup parent) {
  131.  
  132.                          ViewHolder holder;
  133.  
  134.                          
  135.  
  136.                          
  137.  
  138.                          if (convertView == null) {  
  139.  
  140.                                  convertView = mInflater.inflate(R.layout.indian_recipes, null);
  141.  
  142.                                  holder = new ViewHolder();                              
  143.  
  144.                                  holder.text = (TextView) convertView.findViewById(R.id.textview01);  
  145.  
  146.                                  holder.icon = (ImageView) convertView.findViewById(R.id.ImageView01);                         
  147.  
  148.                                  convertView.setTag(holder);
  149.  
  150.                          }
  151.  
  152.                          else
  153.  
  154.                          {
  155.  
  156.                                  holder = (ViewHolder) convertView.getTag();
  157.  
  158.                          }
  159.  
  160.                          
  161.  
  162.                          holder.text.setText(DATA[position]);
  163.  
  164.                          
  165.  
  166.                          
  167.  
  168.                          //holder.icon.setImageBitmap((position & 1) == 1 ? mIcon1 : mIcon2);
  169.  
  170.                          switch (position)
  171.  
  172.                          {
  173.  
  174.                                  case 0:
  175.  
  176.                                          holder.icon.setImageBitmap(mIcon1  );
  177.  
  178.                                          break;
  179.  
  180.                                  case 1:
  181.  
  182.                                          holder.icon.setImageBitmap(mIcon2  );
  183.  
  184.                                          break;
  185.  
  186.                                  case 2:
  187.  
  188.                                          holder.icon.setImageBitmap(mIcon3  );
  189.  
  190.                                          break;
  191.  
  192.                                  case 3:
  193.  
  194.                                          holder.icon.setImageBitmap(mIcon4  );
  195.  
  196.                                          break;
  197.  
  198.                                  case 4:
  199.  
  200.                                          holder.icon.setImageBitmap(mIcon5  );
  201.  
  202.                                          break;
  203.  
  204.                                  case 5:
  205.  
  206.                                          holder.icon.setImageBitmap(mIcon6  );
  207.  
  208.                                          break;
  209.  
  210.                                          
  211.  
  212.                                  case 6:
  213.  
  214.                                          holder.icon.setImageBitmap(mIcon7  );
  215.  
  216.                                          break;
  217.  
  218.                                  case 7:
  219.  
  220.                                          holder.icon.setImageBitmap(mIcon8  );
  221.  
  222.                                          break;
  223.  
  224.                                  case 8:
  225.  
  226.                                          holder.icon.setImageBitmap(mIcon9  );
  227.  
  228.                                          break;
  229.  
  230.                                  case 9:
  231.  
  232.                                          holder.icon.setImageBitmap(mIcon10  );
  233.  
  234.                                          break;
  235.  
  236.                                  case 10:
  237.  
  238.                                          holder.icon.setImageBitmap(mIcon11  );
  239.  
  240.                                          break;
  241.  
  242.                                  case 11:
  243.  
  244.                                          holder.icon.setImageBitmap(mIcon12 );
  245.  
  246.                                          break;
  247.  
  248.                          }
  249.  
  250.                          
  251.  
  252.                          return convertView;
  253.  
  254.                  }
  255.  
  256.                  static class ViewHolder {
  257.  
  258.                          TextView text;        
  259.  
  260.                          ImageView icon;  
  261.  
  262.                        
  263.  
  264.                          }
  265.  
  266.         }
  267.  
  268.        
  269.  
  270.                  
  271.  
  272.                  
  273.  
  274.                  private static final String[] DATA ={"   Vegetable Samosa", "   Cabbage Sabudana Vada","   Khaman Dhokla","   Cabbage Idli",
  275.  
  276.                          "   Amritsari Fish","   Vegetable Pakora","   Chicken Pakora","   Tandori Chicken","   Aloo Keema Tikka","   Gobi Pakora","   Sabudana Vada","   Tangy Paneer Chilli"};
  277.  
  278.        
  279.  
  280.                  protected void onListItemClick(ListView l, View v, int position, long id) {
  281.  
  282.                          
  283.  
  284.                         // TODO Auto-generated method stub
  285.  
  286.                          super.onListItemClick(l, v, position, id);
  287.  
  288.                          Intent intent = new Intent();
  289.  
  290.                          Bundle bundle = new Bundle();
  291.  
  292.                          bundle.putString("country", l.getItemAtPosition(position).toString());  
  293.  
  294.                          intent.putExtras(bundle);
  295.  
  296.                          setResult(RESULT_OK, intent);
  297.  
  298.                          finish();
  299.  
  300.                 }
  301.  
  302.        
  303.  
  304.     /** Called when the activity is first created. */
  305.  
  306.     @Override
  307.  
  308.     public void onCreate(Bundle savedInstanceState) {
  309.  
  310.         super.onCreate(savedInstanceState);  
  311.  
  312.         getListView().setCacheColorHint(1);
  313.  
  314.         getListView().setBackgroundResource(R.drawable.ihome);      
  315.  
  316.         getListView().setPadding(10,85, 0, 0);
  317.  
  318.         getListView().getPaddingTop();
  319.  
  320.       TextView th= new TextView(this);[/b]//==========================
  321.  
  322.         th.setText("Starter");[/b]//===================
  323.  
  324.         getListView().addHeaderView(th, "", false);//===========================
  325.  
  326.        
  327.  
  328.         setListAdapter(new EfficientAdapter(this));          
  329.  
  330.        
  331.  
  332.     }
  333.  
  334.    
  335.  
  336. }
  337.  
  338.  
Parsed in 0.055 seconds, using GeSHi 1.0.8.4
nbagade
Experienced Developer
Experienced Developer
 
Posts: 58
Joined: Fri Nov 20, 2009 7:49 am
Location: India

Postby achie1266 » Wed Dec 30, 2009 9:29 am

if you look at your onCreate method
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.     public void onCreate(Bundle savedInstanceState) {
  2.  
  3.         super.onCreate(savedInstanceState);  
  4.  
  5.         getListView().setCacheColorHint(1);...........
Parsed in 0.035 seconds, using GeSHi 1.0.8.4

I did not understand how you inflated the layout. You are calling getListView method. but where did you inflate the list view.
Like where did you call the setContentView method.
Unless i know how you are inflating it, i cannot go further.

The next time you post it, you may strip off all the code like your Adapter class and all the import lines so that we can focus quickly to where we need to look
achie
User avatar
achie1266
Master Developer
Master Developer
 
Posts: 223
Joined: Mon Nov 09, 2009 10:56 pm
Location: Denver

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 12 guests