I am using this EndlessRecyclerView.java class to add footer or load more view to the RecyclerView. I have set a footer using the setProgressView() of the EndlessRecyclerView.java i.e.
mRecyclerView.setProgressView(R.layout.recyclerview_footer_layout);
Now after a specific situation, say after a network timeout, I want to change the TextView value in footer. But I am unable to do so using the follwing code:
View progressView = inflater.inflate(R.layout.recyclerview_footer_layout, null);
progressViewText = (TextView) progressView.findViewById(R.id.loadMoreText);
What is wrong here?
Related
I am trying to create a like and dislike button. I use Checkboxes to do so.
In the XML code I have two checkboxes one called like and the other dislike
I'm trying to toggle between the like and dislike buttons. Such that they both cannot be switched on at the same time.
public void onLike(View view) {
if (dislike.isChecked()) {
dislike.setChecked(false);
}
Toast.makeText(this,"liked",Toast.LENGTH_SHORT).show();
}
The issue that I am having is that set setChecked(true) is not doing anything.
For more context, the XML for the checkbox is defined inside a fragment that has a cardview. Each item in the card view has the checkboxes.
the way I initialized the checkbox in the main activity is as follows: -
View cardViewLayout = getLayoutInflater().inflate(R.layout.text_row_item,null);
like = (CheckBox) cardViewLayout.findViewById(R.id.like);
dislike = (CheckBox) cardViewLayout.findViewById(R.id.dislike);
any ideas what's going on?
ok, I've figured out the solution. Since I am using a recycler view with a custom adapter I need to bind the onClick listener via an interface.
Here is a link to another post that will show the necessary steps to implement click listeners in adapters: https://stackoverflow.com/a/49969478/11379938
i worked with AccessibilityService,everything is ok.
i want get text from screen, but it's a view, not TextView.
someone tell me how to.
it show view with Monitor, but show text too.
AccessibilityNodeInfo nodeRoot = this.getRootInActiveWindow();
List nodeInfoList = nodeRoot.findAccessibilityNodeInfosByViewId("com.tencent.mm:id/oz");
AccessibilityNodeInfo info = nodeInfoList.get(1);
Log.d(TAG, info.getText());
example
you how set text for this View?
when settext for view: You can set a tag for this view and save this tag and its value in hashmap(key is tag) and retrieve it when needed by tag.
I want to show my text view as shown in Image Below, for which i have to
remove other Views (as I have taken a Text View, Image View and a Video View
in a single XML). I am using Item Holder to show my Text View, and
want to hide Video View and Image View together.
I m trying to code but it is not working.
itemHolder.textViewMessage = (TextView) convertView
.findViewById(R.id.messageDetail);
if (itemHolder.textViewMessage != null && messageBean.getMessage()!=null)
{
itemHolder.textViewMessage.setText(messageBean.getMessage()); // here i am showing my text messages.
itemHolder.imageview2.setVisibility(View.GONE);
itemHolder.videoView.setVisibility(View.GONE);
}
[1]: http://i.stack.imgur.com/PsKTL.png
[2]: http://i.stack.imgur.com/XYCMb.png
In images given above, I don't need extra space below text.
Here Image View and Video View are showing extra space, which
I want to get Invisible.
Here view.gone not Working
I have a tablerow in a tablelayout. Now, I can get tablerows without problem. Tablerow contains a linearlayout and the linearlayout contains views that I need. Is there any possibility to get the linearlayout, and then the from it views?
I cannot do this, because View doesn't have getChildAt method:
View layout = row.getChildAt(j);
EditText first = (EditText)layout.getChildAt(0);
I cannot do this either, because it leads to runtime error when converting View to Layout:
LinearLayout layout = (LinearLayout)row.getChildAt(j);
EditText first = (EditText)layout.getChildAt(0);
If someone has better solution then post it and I'll mark it as solution.
The way I solved this was by adding ID to layout before adding it to the tablerow:
layout.setId(id);
row.addView(layout);
And then getting layout by ID:
View layout =row.getChildAt(j);
LinearLayout layoutLL = (LinearLayout) findViewById(layout.getId());
EditText first = (EditText)layout1.getChildAt(0);
I couldn't post XML-file because layout is made programmatically.
I am new with Android development.
My activity_main.xml file contains a Listview and wanna put a TextView each line of list view. Then I added a new layout file under layout/ folder to identify my text.
But, I couldn't access the layout and TextView while writing inflate in Adapter class.
Below the piece of Adapter class code.
View lineView;
lineView = mInflater.inflate(R.layout.line_layout, null);
TextView textView = (TextView) lineView.findViewById(R.id.namesurname);
Andy idea why getting compile error with this code?