So, my program works fine. I only have three warnings left (one for each popupwindow) and it annoys me alot, I've been serching around for a solution that would fit my needs but I can't seem to find one.
This is my code (the other two popupwindows are similar)
else if(id == R.id.action_resetstats){
LayoutInflater layoutInflater = (LayoutInflater)getBaseContext().getSystemService(LAYOUT_INFLATER_SERVICE);
View popupView = layoutInflater.inflate(R.layout.resetpop, null);
final PopupWindow popupWindow = new PopupWindow(popupView,LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
Button yesDismiss = (Button)popupView.findViewById(R.id.yesDismiss);
yesDismiss.setOnClickListener(new Button.OnClickListener(){
#Override
public void onClick(View v){
SharedPreferences prefs = getSharedPreferences(savedData, Context.MODE_PRIVATE);
Editor editor = prefs.edit();
editor.clear();
editor.commit();
counterW = 0;
counterL = 0;
counterT = 0;
counterTot = 0;
timerTime = 3;
popupWindow.dismiss();
}
});
popupWindow.showAsDropDown(yeDismiss, 50, 50);
Button noDismiss = (Button)popupView.findViewById(R.id.noDismiss);
noDismiss.setOnClickListener(new Button.OnClickListener(){
#Override
public void onClick(View v){
popupWindow.dismiss();
}
});
popupWindow.showAsDropDown(naDismiss, 50, 50);
xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_margin="5dp"
android:background="#android:color/black"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout
android:layout_width="230dp"
android:layout_height="300dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_margin="2dp"
android:background="#android:color/darker_gray"
android:orientation="vertical" >
<Button
android:id="#+id/noDismiss"
android:layout_width="100dp"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:text="NO!" />
<RelativeLayout
android:id="#+id/relativeLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=" Reset stats?"
android:textSize="22sp" />
</RelativeLayout>
<Button
android:id="#+id/yesDismiss"
android:layout_width="100dp"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:text="Yes" />
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/relativeLayout1"
android:layout_centerHorizontal="true"
android:layout_marginTop="34dp"
android:text="Are you sure you want " />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/textView1"
android:layout_centerHorizontal="true"
android:text="to reset your statistics?" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/textView2"
android:layout_centerHorizontal="true"
android:layout_marginTop="39dp"
android:text="!CANNOT BE UNDONE!" />
</RelativeLayout>
</RelativeLayout>
The problem is here to clear things up:
View popupView = layoutInflater.inflate(R.layout.resetpop, null);
and the warning says:
Avoid passing null as the view root (needed to resolve layout parameters on the inflated layout's root element)
Any ideas how to solve this the best way? Thanks in advance!
You could just use:
context = popupView.getContext();
inflater.inflate(R.layout.resetpop, new LinearLayout(context), false);
That should solve the warning.
When you write below code blog, you mean inflate this layout with parent, attach it to parent, but because of pass null, inflater wont be able to attach new parent
View popupView = layoutInflater.inflate(R.layout.resetpop, null);
LayoutInflater class -->
350
351 public View More ...inflate(int resource, ViewGroup root) {
352 return inflate(resource, root, root != null);
353 }
But this, it will inflate with given parent, but wont attach it to the new parent.
View popupView = layoutInflater.inflate(R.layout.resetpop, new LinearLayout(context), false);
PopupWindow Performance Issues and Unable Dismiss
In case someone stumbled upon here, because of some performance issues on the PopupWindow.
It is when your had the PopupWindow launched, but just freezes the entire screen and without able proceed unless restarting the app. Happens on older devices, mine happened to be Samsung GT-N7100 (API 19).
Well, I've tried with solving the warning when using the LayoutInflater. But, didn't solve the lagging issue.
Step 1 - Set View to Render Using Software Acceleration
According to this forum post, all I need is to set the view to use software acceleration for the view instead. Then, everything is just right as rain.
https://androidforums.com/threads/android-popupwindow-performance-issues.882794/
val popupView = inflater.inflate(R.layout.popup_tooltip, null)
popupView.setLayerType(View.LAYER_TYPE_SOFTWARE, null)
Step 2 - Set PopupWindow Focusable Attributes to Dismiss
Immediately after that, I still have issues dismissing the PopupWindow. If only the focusable is set to true, the performance issue will still persist.
I have to manually set the attributes to allow it to be dismissed when a click is detected.
https://stackoverflow.com/a/45408724/2867351
val popupWindow = PopupWindow(popupView, LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT)
popupWindow.isFocusable = true
popupWindow.isOutsideTouchable = true
popupWindow.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
That's about it. Cheers mate 🎉
Related
I have this XML:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/button_bar"
style="?android:buttonBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
style="?android:attr/borderlessButtonStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:gravity="center"
android:textColor="#color/md_green_400" />
<Button
android:id="#+id/action_button"
style="?android:attr/borderlessButtonStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:gravity="center"
android:textColor="#color/md_green_400" />
</LinearLayout>
It´s just a buttonBar with two borderless buttons. It works. However, I don't want that, I need to inflate these buttons from a JSONArray. So I did this:
for (int b = 0; b < buttons.length(); b++) {
final JSONObject button = buttons.getJSONObject(b);
LinearLayout buttonBar = (LinearLayout) child.findViewById(R.id.button_bar);
View buttonChild = getLayoutInflater().inflate(R.layout.flat_button, null);
Button action = (Button) buttonChild.findViewById(R.id.action_button);
action.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {}
});
action.setText(button.getString("descricao"));
action.setTextColor(Color.parseColor(button.getString("text_color")));
buttonBar.addView(buttonChild);
}
It works too, but the buttons get a left alignment. I want they justified.
Why it works when I let them fixed but not when I inflate them?
OBS: The "button_bar" is A XML just with a LinearLayout and the "ActionButton" is just a XML with a Button.
This is the root of your problem:
View buttonChild = getLayoutInflater().inflate(R.layout.flat_button, null);
If you don't provide the parent view to the inflate() method, any LayoutParams attributes (e.g. layout_gravity) will be discarded since the parent is the one to interpret those attributes.
You can fix this by changing it to:
View buttonChild = getLayoutInflater().inflate(
R.layout.flat_button, buttonBar, false);
Which will give it the parent you're attaching it to, but not attach it to the hierarchy yet (you do that below with addView()).
I have founded many solutions for this problem but none of them have worked for me. I want to show a PopupWindow inside a Fragment. This is my code
LayoutInflater layoutInflater = LayoutInflater.from(getActivity());
View popupView = layoutInflater.inflate(R.layout.pop_up_cargando, null,false);
this.popupWindow = new PopupWindow(popupView, popupView.getWidth(),popupView.getHeight());
this.popupWindow.setFocusable(true);
int location[] = new int[2];
this.btnInventario.getLocationOnScreen(location);
this.popupWindow.showAtLocation(this.btnInventario, Gravity.NO_GRAVITY, location[0], location[1] + btnInventario.getHeight()); // this.btnInventario is the button that calls this code
this.popupWindow.update(0, 0, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
But the PopupWindow never appears.
Edit: This is the content of pop_up_cargando
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/popup_recomendar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ffffff"
android:orientation="vertical" >
<ProgressBar
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="180dp"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="20dp"
android:layout_gravity="center"
android:id="#+id/cargando"/>
<TextView
android:id="#+id/txtTexto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_gravity="center"
android:text="#string/vacio"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
Any suggestions? What I'm doing wrong? Your help will be very appreciated.
Your popupView.getWidth() and popupView.getHeight() values are equals to 0 because the view has not been drawn yet.
Before asking for the width and the height of your view, you have to ensure that it has been drawn. For that you can call the following method after it has been inflated:
popupView.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
After that, the size of your view is available with the methods getMeasuredWidth() and getMeasuredHeight().
I have a ListView and the last list item contains EditText:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<RelativeLayout
android:id="#+id/contentLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="30dp"
android:orientation="vertical" >
<ImageView
android:id="#+id/test"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="#+id/messageEditText"
android:layout_below="#+id/messageEditText"
android:layout_marginRight="14dp"
android:src="#drawable/test" />
<EditText
android:id="#+id/messageEditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_toLeftOf="#+id/sendImageButton"
android:ems="10"
android:gravity="top"
android:hint="#string/messageEditText"
android:inputType="textMultiLine"
android:minHeight="55dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp" />
<ImageButton
android:id="#+id/sendImageButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#id/messageEditText"
android:layout_alignParentRight="true"
android:layout_alignTop="#id/messageEditText"
android:adjustViewBounds="true"
android:maxHeight="55dp"
android:maxWidth="55dp"
android:padding="12dp"
android:scaleType="centerInside"
android:src="#drawable/sendmessage" />
</RelativeLayout>
</RelativeLayout>
Half of the EditText is hidden. I also can't scroll ListView. Any solution?
Solution was to set an android:softInputMode attribute to adjustResize in Manifest and put layout(not list item layout) inside a ScrollView.
I Had a similar issue, then i used android:windowSoftInputMode="adjustResize|stateHidden" as mentioned here.. It works very well for me..
From my early days as a Android Developer I struggled with the virtual keyboard. I am amazed that Android is still not giving an elegant and clear solution for this.
So here is the Workaround that will put this mess behind you. it will work without the ScrollView workaround or giving away your full screen flag.
Add this awesome Library to your gradle file:
compile'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:1.0.1'
Make sure your activity has the following keyboard settings:
android:windowSoftInputMode="adjustResize"
wrap your EditText with a vertical LinearLayout and add a View with Visibility of Gone:
<com.ylimitapp.ylimitadmin.views.NormalFontEditText
android:id="#+id/input_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textCapSentences|textMultiLine"
android:imeOptions="actionSend"
android:paddingStart="20dp"
android:paddingEnd="40dp"
android:paddingTop="10dp"
android:maxHeight="120dp"
android:adjustViewBounds= "true"
android:scrollHorizontally="false"
android:textColorHint="#7b7b7b"
android:hint="#string/type_your_message"
android:background="#drawable/msg_inputfield_bg"
android:textColor="#color/black_text_color"
android:textSize="15.33sp"
/>
<View
android:id="#+id/keyboard_view"
android:layout_width="match_parent"
android:layout_height="20dp"
android:visibility="gone"
/>
</LinearLayout>
calculate the screen size so you can calculate the height of the view that pushes the EditText:
private void storeScreenHeightForKeyboardHeightCalculations() {
Rect r = new Rect();
View rootview = getActivity().getWindow().getDecorView();
rootview.getWindowVisibleDisplayFrame(r);
mOriginalScreenHeight = r.height();
Rect rectangle = new Rect();
Window window = getActivity().getWindow();
window.getDecorView().getWindowVisibleDisplayFrame(rectangle);
int statusBarHeight = rectangle.top;
int contentViewTop =
window.findViewById(Window.ID_ANDROID_CONTENT).getTop();
int titleBarHeight= contentViewTop - statusBarHeight;
if (titleBarHeight == 0) {
mOriginalScreenHeight -= (24 * Utils.getDensity(getContext()));
}
}
Add a Listener for keyboard open and close event and then set the height of the View below the EditText on runtime so we will set the height properly on any device and custom keyboards. then simply make it Visible when the Keyboard is Open:
private void addkeyBoardlistener() {
KeyboardVisibilityEvent.setEventListener(
getActivity(),
new KeyboardVisibilityEventListener() {
#Override
public void onVisibilityChanged(boolean isOpen) {
if (isOpen) {
Rect r = new Rect();
View rootview = getActivity().getWindow().getDecorView(); // this = activity
rootview.getWindowVisibleDisplayFrame(r);
int keyboardHeight = (mOriginalScreenHeight - r.height());
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) keyboard_view.getLayoutParams();
params.height = (int) ((keyboardHeight + 5 * Utils.getDensity(getContext())));
keyboard_view.setLayoutParams(params);
keyboard_view.setVisibility(View.VISIBLE);
} else {
keyboard_view.setVisibility(View.GONE);
}
}
});
}
This is the result:
Disable the keyboard on window startup
this .getWindow().setSoftInputMode(WindowManager.LayoutParams. SOFT_INPUT_STATE_ALWAYS_HIDDEN );
Set an android:softInputMode attribute for your Activity element in your Manifest.
See the Manifest documentation for a full list of valid values and their effect. The ones of particular interest to you will likely be adjustPan and adjustResize.
Add this in the manifest like so:
<activity
android:name="your_activity_name"
android:windowSoftInputMode="adjustResize"
android:theme="#style/Theme.AppCompat.DayNight.NoActionBar" />
Then add paddingBottom="20dp" in your layout and editText.
I just used created by first Dialog using DialogFragment.
Everything works great except I can't get the Dialog to wrap it's layout.
My layout has the height of all elements to wrap_content.
In MyFragmentDialog I can't even find a method that would imply that it can be used to set the height of the FragmentDialog. What am I missing? How do I make a DialogFragment fit it's content?
The DialogFrament's onCreateView method:
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Set title for this dialog
getDialog().setTitle("Backup & Restore");
getDialog().setCancelable(true);
View v = inflater.inflate(R.layout.backup_restore, container, false);
TextView msg = (TextView) v.findViewById(R.id.br_label_message);
msg.setText("Backups are placed in the Downloads Directory:\n" + BACKUP_PATH.getAbsolutePath());
// TextView files_label = (TextView) v.findViewById(R.id.label_restore);
Spinner files = (Spinner) v.findViewById(R.id.br_restore_file);
if (BACKUP_PATH.exists()) {
FilenameFilter filter = new FilenameFilter() {
public boolean accept(File dir, String filename) {
File sel = new File(dir, filename);
return filename.contains(FTYPE) || sel.isDirectory();
}
};
mFileList = BACKUP_PATH.list(filter);
} else {
mFileList = new String[0];
}
ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(getActivity(), android.R.layout.simple_spinner_item, mFileList);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
files.setAdapter(adapter);
files.setOnItemSelectedListener(this);
Button backup = (Button) v.findViewById(R.id.br_backup_btn);
Button restore = (Button) v.findViewById(R.id.br_restore_btn);
Button cancel = (Button) v.findViewById(R.id.br_cancel_btn);
backup.setOnClickListener(this);
restore.setOnClickListener(this);
cancel.setOnClickListener(this);
return v;
}
This is the 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"
android:padding="8dp" >
<TextView
android:id="#+id/br_label_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="8dp"
android:text=""
android:textSize="14sp" />
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TableRow
android:id="#+id/br_tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/br_label_restore"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="8dp"
android:text="Restore file"
android:textSize="14sp" />
<Spinner
android:id="#+id/br_restore_file"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
</TableLayout>
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TableRow>
<Button
android:id="#+id/br_restore_btn"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:text="Restore"
android:textSize="14sp" />
<Button
android:id="#+id/br_backup_btn"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:text="Backup"
android:textSize="14sp" />
</TableRow>
</TableLayout>
<Button
android:id="#+id/br_cancel_btn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Cancel"
android:textSize="14sp" />
</LinearLayout>
Thanks,
It turns out to be an issue with LinearLayout despite setting a height on it, in DialogFragment it seems to be taking more space than I want it to. I switched layout to be a RelativeLayout the content Dialog seems to resize to fit the content.
You can make it work with all kind of layout in adding the size of the layout in the onResume of your dialogFragment :
#Override
public void onResume()
{
super.onResume();
Window window = getDialog().getWindow();
window.setLayout(300, 300);
window.setGravity(Gravity.CENTER);
}
I took a leap into the Dialog api so I am certainly not sure but you could try to call getWindow on the dialog and then call setLayout(width, height)
getDialog().getWindow().setLayout(300,300);
I don't see the top portion of your LinearLayout tag, but I've seen cases where all that was needed was the
android:orientation="vertical"
XML attribute. It can cause a headache but is fortunately easy to fix.
Is it possible to use a OnItemClickListener on a ListView when the Items layout has a clickable/editable widget (RadioButton,EditText, or CheckBox)?
You might want to take a look at this issue. Having a focusable item in a row of a ListView causes the OnItemClickListener NOT to be invoked. However, that does not mean you cannot have focusable/clickable items in a row, there are some workarounds like this one.
Also, you can take a look at the Call Logs screen. It has a ListView with clickable item(the call icon on the right).
See Source code here
Quoting comment #31 in the link mentioned by Samuh (which solved the problem for me):
In fact you can add it to the layout XML (if inflated by one): android:descendantFocusability="blocksDescendants".
Adding here JIC that webpage is down in the future.
If any row item of list contains focusable or clickable view then OnItemClickListener won't work.
row item must be having param like android:descendantFocusability="blocksDescendants"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:descendantFocusability="blocksDescendants"
android:gravity="center_vertical" >
// your other widgets here
</LinearLayout>
Tried many complex solutions, but this was the simplest one that worked:
Just use android:focusable="false" as in:
<CheckBox
android:id="#+id/fav_check_box"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="false" />
Two best solution
Add android:descendantFocusability="beforeDescendants" to listView
in xml OR
Set given two attributes to false
like
android:focusable="false"
android:focusableInTouchMode="false"
Then it will handle the listView row item child(Button,EditText etc) events instead of listView.setOnItemClick .
I fixed my problem different , in my item I have more than one LinearLayout
so if you give id to your linearayout and setOnclickListener in adapter class it will work, only original effect of touching will dissapear.
but this link Making a LinearLayout act like an Button is usefull to make linearlaout act like button on click
item
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp">
<TextView
android:id="#+id/txt_item_followers_name"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:gravity="center|start"
android:paddingLeft="15dp"
android:text="Ali"
android:textAppearance="?android:attr/textAppearanceMedium" />
<ImageView
android:id="#+id/imageView"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_alignParentStart="true"
android:layout_below="#+id/txt_item_followers_name"
android:layout_marginLeft="10dp"
android:src="#drawable/puan_icon" />
<TextView
android:id="#+id/txt_item_followers_mark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/imageView"
android:layout_toEndOf="#+id/imageView"
android:background="#color/red_400"
android:paddingLeft="10dp"
android:text="25.5"
android:textAppearance="?android:attr/textAppearanceSmall" />
<LinearLayout
android:id="#+id/linear_one"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_alignParentTop="true"
android:layout_toEndOf="#+id/txt_item_followers_name"
android:background="#color/red_400"
android:orientation="vertical">
<ImageView
android:id="#+id/btn_item_followers_2b_follow"
android:layout_width="100dp"
android:layout_height="match_parent"
android:layout_alignParentEnd="true"
android:layout_marginLeft="10dp"
android:src="#drawable/follow_buton" />
</LinearLayout>
</RelativeLayout>
inside getView method
#Override
public View getView(final int position, View convertView,
ViewGroup parent) {
View view = convertView;
if (convertView == null)
view = inflater.inflate(R.layout.deneme, null);
final Followers2 myObj = myList.get(position);
LinearLayout linear_one = (LinearLayout) view.findViewById(R.id.linear_one); // HERE WE DOMUNİCATE IT
linear_one.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
Toast.makeText(parentActivity, "One Two", Toast.LENGTH_SHORT).show();
}
});
TextView name = (TextView) view.findViewById(R.id.txt_item_followers_name);
TextView mark = (TextView) view.findViewById(R.id.txt_item_followers_mark);
final ImageView btn_follow = (ImageView) view.findViewById(R.id.btn_item_followers_2b_follow);
name.setText(myObj.getName());
mark.setText(myObj.getScore());
/* if (myObj.isFollow() == true) {
btn_follow.setImageResource(R.drawable.following_buton);
} else {
btn_follow.setImageResource(R.drawable.follow_buton);
}
btn_follow.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
Followers2 myObj = myList.get(position);
if (myObj.isFollow() == true) {
btn_follow.setImageResource(R.drawable.following_buton);
} else {
btn_follow.setImageResource(R.drawable.follow_buton);
}
}
});*/
return view;
}