1

The title pretty well covers my question. How can I (for instance) obtain all the TextView elements whose IDs do NOT CONTAIN "some_prefix"? I can obtain all TextView elements and iterate over them, kicking out the ones I don't like (and I probably will), but I'd rather have a clear query which does that for me.

alannichols
  • 1,496
  • 1
  • 10
  • 20
Carl Manaster
  • 39,912
  • 17
  • 102
  • 155

1 Answers1

2

It's inefficient, but you can do:

query("android.widget.TextView") -
    query("android.widget.TextView {id CONTAINS[c] 'some_prefix'}")

The first query gets the set of all TextViews, then excludes those that contain 'some_prefix' as returned in the second query.

hidro
  • 12,333
  • 6
  • 53
  • 53