I have a listview that contains two buttons, a text view and...
I want to set onclicklistener for one button and a textview to do whatever that I set in onitemclicklistener for this listview. but I don't know how can I do that.
these are my lists.xml codes
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="2dp">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="160dp"
android:layout_gravity="center_horizontal"
android:padding="15dp"
android:background="@android:drawable/dialog_holo_light_frame"
android:focusable="false"
android:focusableInTouchMode="false">
<FrameLayout
android:layout_width="132dp"
android:layout_height="120dp"
android:focusable="false"
android:focusableInTouchMode="false"
android:background="@drawable/company1"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:clickable="true"
android:id="@+id/frameLayout">
</FrameLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Small Text"
android:id="@+id/id"
android:visibility="gone"/>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="match_parent"
android:layout_height="35dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/company_name"
android:id="@+id/header_factory_list"
android:gravity="right"
android:focusable="false"
android:focusableInTouchMode="false"
android:textColor="#21313f"
android:textSize="15dp"
android:singleLine="true"/>
<RatingBar
style="@android:style/Widget.DeviceDefault.Light.RatingBar.Small"
android:focusable="false"
android:focusableInTouchMode="false"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/ratingBar2"
android:animationResolution="3"
android:rating="2.5"
android:stepSize=".05"
android:layout_marginLeft="20dp"/>
<Button
android:layout_width="fill_parent"
android:layout_height="25dp"
android:focusable="false"
android:focusableInTouchMode="false"
android:text="@string/add_fav_list"
android:id="@+id/button_add_fav_list"
android:background="#cf000f"
android:layout_marginRight="5dp"
android:layout_marginLeft="5dp"
android:textColor="#ffffff"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:padding="2dp"
android:textSize="10dp"/>
<Button
android:layout_width="fill_parent"
android:layout_height="25dp"
android:focusable="false"
android:text="@string/show_details"
android:id="@+id/button_detsils"
android:background="#21313f"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:textColor="#ffffff"
android:layout_marginBottom="5dp"
android:padding="2dp"
android:textSize="10dp"/>
</LinearLayout>
</LinearLayout>
also these are my onitemclicklistener codes from mainactivity:
Inside_Factory_ListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
Inside_Factory_ListView.setVisibility(View.GONE);
TextView f= (TextView) view.findViewById(R.id.id);
Log.i("GETVIEW",view.getId()+"\n"+f.getText().toString());
setInfoInFactory(Integer.parseInt(f.getText().toString()));
Inside_Factory_Layout.setVisibility(View.VISIBLE);
final TranslateAnimation animation1 = new TranslateAnimation(0.0f, 0.0f,
3000.0f, 0.0f); // new TranslateAnimation(xFrom,xTo, yFrom,yTo)
animation1.setDuration(1500); // animation duration
animation1.setRepeatCount(0); // animation repeat count
animation1.setRepeatMode(0); // repeat animation (left to right, right to left )
//animation.setFillAfter(true);
Handler mHandler = new Handler();
Frist_Tab.setVisibility(View.VISIBLE);
Frist_Tab.startAnimation(animation1);
mHandler.postDelayed(new Runnable() {
public void run() {
Second_Tab.setVisibility(View.VISIBLE);
Second_Tab.startAnimation(animation1);
}
}, 1000);
mHandler.postDelayed(new Runnable() {
public void run() {
Third_Tab.setVisibility(View.VISIBLE);
Third_Tab.startAnimation(animation1);
}
}, 1000);
// Log.i("CLICK","CLICKED="+position);
if(L[1]){
L[2]=true;
}
}
});
I want, when I click on the button(into the listview) happens like i click on that item of list view.
Can anyone please help me?