0

I am having an index.html in my asset folder. I am loading it with following code.

view.loadUrl("file:///android_asset/www/index.html");

When i try connecting with my accessibility service, the text is not getting parsed. I have pasted the log cat for the reference. I am having my own talk back kind of service. I am having second app with a html file. When i load that html file, the webview's ontouch event should speak out the text. The touch event is happening but the html content is not parsed.

02-18 05:36:43.190 4398-4398/com.example.vinay.screenreader V/MyScreenReaderService: I am in accessibility service 1048576 02-18 05:36:43.191 4398-4398/com.example.vinay.screenreader V/MyScreenReaderService: onAccessibilityEvent: [type] TYPE_TOUCH_INTERACTION_START [class] null [package] null [time] 20184170 [text] [] [description] null

02-18 05:36:43.249 4398-4398/com.example.vinay.screenreader V/MyScreenReaderService: I am in accessibility service 2048 02-18 05:36:43.251 4398-4398/com.example.vinay.screenreader V/MyScreenReaderService: onAccessibilityEvent: [type] TYPE_WINDOW_CONTENT_CHANGED [class] android.widget.FrameLayout [package] com.android.systemui [time] 20184228 [text] [] [description] null

02-18 05:36:43.492 4398-4398/com.example.vinay.screenreader V/MyScreenReaderService: I am in accessibility service 512 02-18 05:36:43.493 4398-4398/com.example.vinay.screenreader V/MyScreenReaderService: onAccessibilityEvent: [type] TYPE_TOUCH_EXPLORATION_GESTURE_START [class] null [package] null [time] 20184471 [text] [] [description] null

02-18 05:36:43.970 4398-4398/com.example.vinay.screenreader V/MyScreenReaderService: I am in accessibility service 1024 02-18 05:36:43.972 4398-4398/com.example.vinay.screenreader V/MyScreenReaderService: onAccessibilityEvent: [type] TYPE_TOUCH_EXPLORATION_GESTURE_END [class] null [package] null [time] 20184946 [text] [] [description] null I am in accessibility service 2097152

02-18 05:36:43.973 4398-4398/com.example.vinay.screenreader V/MyScreenReaderService: onAccessibilityEvent: [type] TYPE_TOUCH_INTERACTION_END [class] null [package] null [time] 20184946 [text] [] [description] null

view.setOnTouchListener 

actually should enter the TYPE_VIEW_HOVER_ENTER. But its not entering. Please help me with the problem.

xml code

My xml code is               
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="1"
android:orientation="vertical">
<WebView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/webview"
    android:layout_gravity="top"
    android:layout_weight="0.90"
    />
</LinearLayout>
Gayu R
  • 41
  • 6
  • Hi Gayu R, please update your question by editing it such that a Java noob like me is able to ***reproduce*** your error ;-) Tell us how you got there with a nice introduction. Also restructure your error-message with nice indents such its no longer a single line of characters... it scares people and triggers a "triage-review" and down-vote frenzy. – ZF007 Feb 18 '19 at 10:58

1 Answers1

0
<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
android:accessibilityEventTypes="typeWindowContentChanged|typeViewFocused"
android:accessibilityFlags="flagIncludeNotImportantViews|flagReportViewIds"
android:canRetrieveWindowContent="true"
android:canRequestTouchExplorationMode="true"
android:packageNames="com.whatsapp"
android:accessibilityFeedbackType="feedbackSpoken"
android:notificationTimeout="500"
/>
  • Thanks for the answer. Do i have to include the packagename of the second app in accesibility service? – Gayu R Feb 19 '19 at 05:44
  • Thanks again @Darshan Kachhadiya Ok i will try and let you know – Gayu R Feb 19 '19 at 06:00
  • I tried adding the package name still it is not working. What i have to do to access google's web page. Do i have to give any permission to access google page with my accessibility service? – Gayu R Feb 19 '19 at 06:24
  • Why webview's ontouchlistener is showing the warning **CustomView 'WebView' has setOnTouchLustner called on it but does not override performclick(). If a view that overrides OnTouchEvent or uses an OnTouchListener doesnot also implement performclick & call it when clicks are properly.Logic handling the click actions should ideally be place in view#performclick as some accessibility services invoke performclick when a click action should occur** – Gayu R Feb 19 '19 at 06:52
  • The following is the code which gives the warning. What i am doing wrong in the code. `view.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { return (event.getAction() == MotionEvent.ACTION_MOVE); // disabling touch events } });` – Gayu R Feb 19 '19 at 06:54
  • bcoz when you click at that time html call and it need access from another app so problem in access service – Darshan Kachhadiya Feb 19 '19 at 06:56
  • If the problem is in my accessibility service then even my button's text should not speak right. But the button's text of my second app is speaking fine. Only my webview content is not speaking. – Gayu R Feb 19 '19 at 07:01
  • https://stackoverflow.com/questions/47107105/android-button-has-setontouchlistener-called-on-it-but-does-not-override-perform refer it if you use customewebview – Darshan Kachhadiya Feb 19 '19 at 07:24
  • I will refer to what you have suggested. I couldn't understand what is custom webview. Can you please tell me what is customwebview? I am adding my xml code for your reference. – Gayu R Feb 19 '19 at 07:45