Hi I am developing an android app with CursorAdapter for loading the listview. onItemClick of the listview item, I am trying to start a dialogue activity.
adapter = new ConversationAdapter(MainActivity.this, cursor);
list.setAdapter(adapter);
list.setOnItemClickListener(new OnItemClickListener()
{
public void onItemClick(AdapterView<?> parent, View view, int position, long arg3)
{
Cursor cur = (Cursor) adapter.getItem(position);
cur.moveToPosition(position);
id = cur.getString(cur.getColumnIndexOrThrow("_id"));
Intent intent = new Intent(MainActivity.this, DialogueActivity.class);
Bundle bundle = new Bundle();
bundle.putString ("id", id);
intent.putExtras(bundle);
startActivity(intent);
}
});
I am using only the startActivity without a finish(). The problem is the listview which is to be displayed at back disappears and there is just a black screen. Not sure what I need to do so that listview is displayed in background of DialogueActivity.
onItemClick of the listview item is displayed as below
main_activity.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".EaseSms" >
<LinearLayout
android:id="#+id/linearlayoutlistSMS"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".88"
android:orientation="vertical"
android:paddingBottom="3dp" >
<ListView
android:id="#android:id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:cacheColorHint="#00000000"
android:divider="#000000"
android:dividerHeight="5dp" >
</ListView>
<TextView
android:id="#+id/Nosms"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="No SMS to display"
android:textColor="#FFFFFF"
android:textSize="28dp"
android:textStyle="bold"
android:visibility="gone" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayoutCreateMessage"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".12"
android:gravity="center"
android:orientation="horizontal" >
<LinearLayout
android:id="#+id/createmsg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/newcreatesms"
android:gravity="center"
android:orientation="horizontal" >
</LinearLayout>
</LinearLayout>
and dialogue_activity.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/linearLayoutdeleteall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight=".33"
android:background="#drawable/cal_sms_bg"
android:gravity="center|left"
android:orientation="vertical"
android:paddingTop="5dp" >
<ImageView
android:id="#+id/edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#null"
android:src="#drawable/newdeleteconversation"
android:visibility="visible" />
</LinearLayout>
</LinearLayout>
please Help. Thanks!
Try this codes..
getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
before setContentView(R.layout.activity); in DialogueActivity.class
Related
I am trying to add textview dynamically in alertdialog. But end up with null pointer error.
My code...
att_layout = (LinearLayout)findViewById(R.id.att_layout);
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(Consultation.this);
LayoutInflater inflater = getLayoutInflater();
View dialogView = inflater.inflate(R.layout.alert_label_editor, null);
dialogBuilder.setView(dialogView);
TextView con = (TextView) dialogView.findViewById(R.id.textView29);
con.setText("Consultation on " + item.getString(4));
TextView des = (TextView) dialogView.findViewById(R.id.textView28);
des.setText(item.getString(2));
TextView pre = (TextView) dialogView.findViewById(R.id.textView31);
pre.setText(item.getString(3));
TextView fee = (TextView) dialogView.findViewById(R.id.textView32);
fee.setText(item.getString(5));
if (att.getCount() == 0) {
att.close();
} else {
//here is the part where error occurs
View addView = inflater.inflate(R.layout.att_values, null);
TextView att_name=(TextView)addView.findViewById(R.id.textView34);
att_name.setText(att.getString(3));
TextView att_value=(TextView)addView.findViewById(R.id.textView26);
att_value.setText(att.getString(4));
att_layout.addView(addView);
}
adapter1 = new GridViewAdapter(FilePathStrings, getApplicationContext());
grid = (GridView) dialogView.findViewById(R.id.gridview);
grid.setAdapter(adapter1);
grid.setOnItemClickListener(new AdapterView.OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse("file://" + FilePathStrings[position]), "image/*");
startActivity(intent);
}
});
final AlertDialog alertDialog = dialogBuilder.create();
alertDialog.show();
alert_label_editor.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:paddingTop="10dp"
android:paddingBottom="20dp">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:text="TextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView29"
android:layout_weight="1"
android:gravity="center"
android:textSize="24sp"
android:layout_marginBottom="10dp"
android:textStyle="normal|bold" />
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:text="Description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/textView27"
android:layout_weight="2" />
<TextView
android:text="TextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/textView28"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:text="Prescription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/textView30"
android:layout_weight="2" />
<TextView
android:text="TextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/textView31"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:text="fee"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/textView33"
android:layout_weight="2" />
<TextView
android:text="TextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/textView32"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/att_layout"></LinearLayout>
</LinearLayout>
</ScrollView>
<GridView
android:id="#+id/gridview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:columnWidth="90dp"
android:numColumns="auto_fit"
android:stretchMode="columnWidth" />
</LinearLayout>
att_values.xml
LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:text="TextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/textView34"
android:layout_weight="1"/>
<TextView
android:text="TextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/textView26"
android:layout_weight="1"/>
When i add those dynamically adding code.. its stops worling... The whole other code is working fine...
Logcat...
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.LinearLayout.addView(android.view.View)' on a null object reference
How can i resolve this issue.?
Your alert_label_editor.xml file which contains the R.id.att_layout LinearLayout is not inflated until you run this line:
View dialogView = inflater.inflate(R.layout.alert_label_editor, null);
So when you try to find it in the current view, it is not found and att_layout is null
Move this line after you actually inflate the layout, and use dialogView:
att_layout = (LinearLayout) dialogView.findViewById(R.id.att_layout);
I am trying to change programmatically the background color of ListView item when the user tap on it. I am trying to implement a solution using setOnItemClickListener, but I have trouble making the listener work. Here is my code:
ArrayList<Integer> menuIcons = app.Theme.Icons.getMenuPanelIconList();
ArrayList<String> menuText = app.Languages.Active.getMenuPanelItemNames();
listview_menu = (ListView) findViewById(R.id.listview_menu);
listview_menu.setBackgroundColor(Color.parseColor("#" + app.Theme.ThemeBackColor));
MenuPanelListViewAdapter menuPanelListViewAdapter = new MenuPanelListViewAdapter(ActivityMain.this, menuIcons, menuText);
listview_menu.setAdapter(menuPanelListViewAdapter);
listview_menu.setOnItemClickListener(new AdapterView.OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> adpterView, View view, int position,
long id) {
for (int i = 0; i < listview_menu.getChildCount(); i++) {
if(position == i ){
listview_menu.getChildAt(i).setBackgroundColor(Color.BLUE);
}else{
listview_menu.getChildAt(i).setBackgroundColor(Color.TRANSPARENT);
}
}
}
});
Here is my mainactivity.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:fresco="http://schemas.android.com/apk/res-auto"
android:id="#+id/relativelayout_base"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="#+id/relativelayout_toolbar"
android:layout_width="match_parent"
android:layout_height="?android:actionBarSize">
<LinearLayout
android:id="#+id/linearlayout_menu"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:clickable="true"
android:gravity="center"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<ImageView
android:id="#+id/imageview_menu"
android:layout_width="20dp"
android:layout_height="20dp"
android:src="#drawable/menushow_g" />
</LinearLayout>
<com.hotelstayapp.android.custom.CustomTextView
android:id="#+id/customtextview_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="#+id/linearlayout_menu"
android:textColor="#FFFFFF"
android:textSize="27sp"
android:ellipsize="end"
android:singleLine="true"
android:paddingBottom="1dp"/>
</RelativeLayout>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.hotelstayapp.android.UI.ActivityMain"
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/relativelayout_toolbar">
<FrameLayout
android:id="#+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent">
</FrameLayout>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/relativelayout_menupanel"
android:layout_width="280dp"
android:layout_height="match_parent"
android:layout_gravity="left">
<RelativeLayout
android:id="#+id/relativelayout_menuheader"
android:layout_width="match_parent"
android:layout_height="130dp"
android:clickable="true">
<com.facebook.drawee.view.SimpleDraweeView
fresco:actualImageScaleType="centerCrop"
android:id="#+id/imageview_menubgimage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
/>
<com.facebook.drawee.view.SimpleDraweeView
android:layout_width="240dp"
android:layout_height="70dp"
fresco:actualImageScaleType="fitCenter"
android:id="#+id/imageview_menulogo"
android:layout_centerInParent="true"
/>
</RelativeLayout>
<ListView
android:id="#+id/listview_menu"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#id/relativelayout_menuheader"
android:layout_gravity="right"
android:divider="#android:color/transparent"
android:dividerHeight="0dp"
android:paddingTop="10dp"
android:smoothScrollbar="true"
android:focusable="false"
android:focusableInTouchMode="false">
</ListView>
</RelativeLayout>
</android.support.v4.widget.DrawerLayout>
</RelativeLayout>
Here is my ListView items layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1"
android:paddingBottom="14dp"
android:paddingTop="14dp"
android:paddingLeft="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_weight="0.8"
android:gravity="center">
<ImageView
android:layout_width="23dp"
android:layout_height="23dp"
android:id="#+id/imageViewIcon"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:src="#drawable/menuhome_g"
android:layout_centerHorizontal="true" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_weight="0.2"
android:paddingLeft="15dp"
android:gravity="center_vertical">
<com.hotelstayapp.android.custom.CustomTextView
android:id="#+id/textViewMenuItemName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center|left"
android:text="Home"
android:textColor="#000000"
android:textSize="15sp"
android:textStyle="bold"/>
</LinearLayout>
</LinearLayout>
<View
android:id="#+id/viewMenuDivider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#eeeeee"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"></View>
</LinearLayout>
First change background of all item to transperent then set clicked view's background to your desired color like below.
MenuPanelListViewAdapter menuPanelListViewAdapter = new MenuPanelListViewAdapter(ActivityMain.this, menuIcons, menuText);
listview_menu.setAdapter(menuPanelListViewAdapter);
listview_menu.setOnItemClickListener(new AdapterView.OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> adpterView, View view, int position,
long id) {
for (int i = 0; i < listview_menu.getChildCount(); i++) {
listview_menu.getChildAt(i).setBackgroundColor(Color.TRANSPARENT);
}
view.setBackgroundColor(Color.BLUE);
menuPanelListViewAdapter.notifyDataSetChanged(); // this is importent
}
});
I have a list view and want to perform clickable event on it. I did it before. but now its not working. I have added my XML as well. I just need to move from one actvity to other on click in list view.
CustomFinalSubmit_ItemDetail item = new CustomFinalSubmit_ItemDetail(Final_Submit.this , R.layout.customview_finalsubmit_itemdetails, itemInfo);
itemList.setAdapter(item);
itemList.setOnItemClickListener(new OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> arg0, View arg1, int position,
long arg3) {
FinalSubmitItem pos = itemInfo.get(position);
String itemType = pos.getItemType();
String itemCountry = pos.getItemCountry();
String itemSerial = pos.getItemNo();
pos.setChecked(true);
Intent inn = new Intent(getApplicationContext(), FinalSubmitDetails.class);
inn.putExtra("itemType", itemType);
inn.putExtra("itemCountry", itemCountry);
inn.putExtra("itemSerial", itemSerial);
startActivity(inn);
}
});
Here is my main Xml:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#color/green">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="fill"
android:layout_marginTop="10dip"
android:orientation="vertical"
android:background="#0B3B0B">
<ListView
android:id="#+id/CustomerDetailList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/yellow"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="3"
android:id="#+id/Itemtype"
android:paddingTop="5dp"
android:background="#color/green"
android:textColor="#color/yellow"
android:layout_marginLeft="5dip"
android:text="Item Type"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="3"
android:paddingTop="5dp"
android:id="#+id/txtcountry"
android:background="#color/green"
android:textColor="#color/yellow"
android:text="Country"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="3"
android:paddingTop="5dp"
android:id="#+id/txtItemNumber"
android:background="#color/green"
android:textColor="#color/yellow"
android:text="Item No."/>
<CheckBox
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="4"
android:id="#+id/itemChck"
android:button="#drawable/custom_checkbox"
android:paddingTop="5dp"
android:padding="5dp"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_margin="5dp"
android:layout_height="1dp"
android:background="#color/white"/>
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/itemList"
android:background="#088A08"
android:divider="#color/white"
android:dividerHeight="1dp"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
I did it this way:
convertView.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
your code
}});
Just add this much code to my customview
Recently I had the same problem after adding a ToggleButton to my list items. The solution for me was to add android:descendantFocusability="blocksDescendants" to the layout of the item.
Here is the whole XML:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:padding="5dp"
android:paddingLeft="15dp"
android:descendantFocusability="blocksDescendants" >
<TextView
android:id="#+id/watch_roadName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="Addresse"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold" />
<ToggleButton
android:id="#+id/watch_button_arrived"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/watch_roadName"
android:layout_alignParentRight="true"
android:textOn="#string/arrived"
android:textOff="#string/arrived"
android:text="#string/arrived" />
</RelativeLayout>
Similar answers to the same issue can be found here:
How to fire onListItemClick in Listactivity with buttons in list?
and here
Android custom ListView with ImageButton is not getting focus
in the widgets(Textview or button whatever it is) of your inflator layout just add:
android:focusable="false"
android:focusableInTouchMode="false"
and in parent layout of your inflator add:
android:descendantFocusability="blocksDescendants"
I have used one gridview calendar in my application.The gridview calendar is working correctly and displayed the element what i want.My problem is when i click the grid item this will not be clickable.Thanks
My Gridview:
<LinearLayout
android:id="#+id/gridlayoutid"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<GridView
android:id="#+id/gridviewid"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:horizontalSpacing="-1px"
android:numColumns="7"
android:stretchMode="columnWidth"
android:textDirection="anyRtl" />
</LinearLayout>
My Grid Rows:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="200dp"
android:layout_height="fill_parent"
android:background="#drawable/gridcal"
android:orientation="vertical">
<TextView
android:id="#+id/griddate"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="10dp"
android:paddingBottom="10dp"
android:textColor="#color/text_color"
android:textSize="14sp"
android:textStyle="bold" >
<!-- android:layout_height="200dp" -->
</TextView>
<TextView
android:id="#+id/gridstatus"
android:layout_gravity="right"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
My Activity:
gridview = (GridView) view.findViewById(R.id.gridviewid);
gridview.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View v,
int position, long id) {
//some codes
}
}
}
});
I am having trouble using ListActivity. If i change class extend from ListActivity to Activity it works fine. But then the trouble is how will i implement the onListItemClick. It muight be some small mistake i might have done but i am not able to trace it.
public class Warehouse extends ListActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
System.out.println("Inside Warehouse");
setContentView(R.layout.warehous);
LinearLayout linear = (LinearLayout) findViewById(R.id.linearfullview);
drawable = setBitMap(background_image);
linear.setBackgroundDrawable(drawable);
String[] names = new String[] { "Inventory Ageing",
"Inventory Carring Cost", "Inventory Turns" };
LinearLayout linearList = (LinearLayout) findViewById(R.id.linearlist);
drawable = setBitMap(list_image);
linearList.setBackgroundDrawable(drawable);
this.setListAdapter(new ArrayAdapter<String>(this,R.layout.warehouse_list,names));
// ListView lv = getListView(); lv.setTextFilterEnabled(true);
}
public Drawable setBitMap(String imagename) {
Bitmap image = BitmapFactory.decodeStream(getClass()
.getResourceAsStream(("/com/image/" + imagename + ".png")));
drawable = new BitmapDrawable(image);
return drawable;
}
protected void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
Object o = this.getListAdapter().getItem(position);
String keyword = o.toString();
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent" android:orientation="horizontal"
android:layout_width="fill_parent">
<LinearLayout android:layout_width="fill_parent"
android:id="#+id/linearfullview" android:layout_height="400sp"
android:layout_alignParentTop="true" />
<LinearLayout android:layout_width="wrap_content"
android:layout_height="180sp" android:layout_alignParentBottom="true"
android:layout_marginTop="20sp">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id = "#+id/linearlist" android:layout_height="wrap_content" android:layout_width="wrap_content"
android:paddingLeft="2dp" android:paddingRight="2dp" android:gravity="bottom"
android:layout_marginTop="30dp">
<ListView android:id="#android:id/list" android:layout_width="100dip" android:layout_height="wrap_content"></ListView>
</LinearLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:paddingLeft="2dp" android:paddingRight="2dp"
android:paddingTop="4dp" android:gravity="bottom"
android:layout_marginTop="30dp">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content" android:id="#+id/linearFirst"
android:layout_alignParentLeft="true" android:layout_width="wrap_content"
android:paddingLeft="2dp" android:paddingRight="2dp"
android:paddingTop="4dp" android:gravity="bottom"
android:layout_marginTop="30dp" android:visibility="invisible">
<com.widget.WheelView
android:id="#+id/firstWheel" android:layout_height="wrap_content"
android:layout_width="100dp" />
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content" android:id="#+id/linearSecond"
android:layout_width="wrap_content" android:paddingLeft="2dp"
android:paddingRight="2dp" android:layout_alignParentRight="true"
android:paddingTop="4dp" android:gravity="bottom"
android:layout_marginTop="30dp" android:visibility="invisible">
<com.widget.WheelView
android:id="#+id/secondWheel" android:layout_height="wrap_content"
android:layout_width="100dp" />
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content" android:id="#+id/linearThird"
android:layout_width="wrap_content" android:paddingLeft="2dp"
android:paddingRight="2dp" android:paddingTop="4dp" android:gravity="bottom"
android:layout_marginTop="30dp" android:layout_alignParentLeft="true"
android:visibility="invisible">
<com.widget.WheelView
android:id="#+id/thirdWheel" android:layout_height="wrap_content"
android:layout_width="200dp" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
if you are extending ListActivity then you must take a Listview in main.xml with #+android:id/list
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent" android:orientation="horizontal"
android:layout_width="fill_parent">
<ListView android:id="#android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent" />
...
Can you use
public class Warehouse extends Activity implements onListItemClick
instead ?
refer http://www.vogella.de/articles/AndroidListView/article.html link.
There is a minor mistake ur making
Best of Luck...