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.
Related
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?
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've got an activity where there is a button which opens an AlertDialog.
My dialog works and I decided to add a layout to it which contains a spinner.
So I have 3 documents :
mainActivity.java : Its role is to open a Dialog
activity_main.xml
dialog_main.xml : The dialog's layout containing the spinner
I try to retrieve in mainActivity.java the spinner declared in dialog_main.xml (in order to add it an adapter) :
Spinner mySpinner = (Spinner)findViewById(R.id.mySpinner);
However mySpinner = NULL, I can't find mySpinner. What is the problem ?
findViewById
as a method of the Activity class finds Views in your Activity's layout. When you are showing a Dialog, it is not part of your layout, so you have to findViewById in the Dialog's layout.
You are probably inflating a View for the Dialog that you show, you cou can use this view to find your Spinnner.
It probably looks like
View view = layoutInflater.inflate (...);
then you do
view.findViewById(...);
Post the code of how how show the Dialog and I'll show you if you can't do it.
I'm implementing a image gallery with a ViewPager.
Each page load a image from Internet and put it in a ImageView.
The gallery also have a share button (external to the ViewPager).
I want to disable the button when the image is loading and re-enable it when the image is visible.
How can I know the status of the current page (if the image is beeing displayed or not) from the Activity containing the ViewPager?
Thanks
You can override setPrimaryItem function
public void setPrimaryItem(android.view.ViewGroup container,
int position, Object object) {
super.setPrimaryItem(container, position, object);
//check if image is loaded here
};
I have created a dialog box like so using a custom layout:
dialog = new Dialog(FetchMenu.this, R.style.CustomDialogTheme);
dialog.setContentView(R.layout.custom_dialog_iab);
dialog.show();
I am now trying to edit a textbox within 'layout.custom_dialog_iab' for example:
TextView text = (TextView) findViewById(R.id.all_topics_unlock_button);
text.setText("Purchased");
My Question: How do I get the right context to be able to edit the textboxes?
P.S. I have tried 'dialog.getContext()' but still keep throwing null pointers?
You need to use:
TextView text = (TextView) dialog.findViewById(R.id.all_topics_unlock_button);
Note the dialog. in front of findViewById
regular findViewById() will search your activity layout rather than the dialog layout.