Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I've wasted a few hours of the last days figuring out a way to do what you (and, me too, by the way) want to do. After looking through the whole source of RemoteViews twice, I figured the only way to accomplish this task is good old, ugly and hacky Java Reflections.</p> <p>Here it is:</p> <pre><code> Notification notification = (Notification) event.getParcelableData(); RemoteViews views = notification.contentView; Class secretClass = views.getClass(); try { Map&lt;Integer, String&gt; text = new HashMap&lt;Integer, String&gt;(); Field outerFields[] = secretClass.getDeclaredFields(); for (int i = 0; i &lt; outerFields.length; i++) { if (!outerFields[i].getName().equals("mActions")) continue; outerFields[i].setAccessible(true); ArrayList&lt;Object&gt; actions = (ArrayList&lt;Object&gt;) outerFields[i] .get(views); for (Object action : actions) { Field innerFields[] = action.getClass().getDeclaredFields(); Object value = null; Integer type = null; Integer viewId = null; for (Field field : innerFields) { field.setAccessible(true); if (field.getName().equals("value")) { value = field.get(action); } else if (field.getName().equals("type")) { type = field.getInt(action); } else if (field.getName().equals("viewId")) { viewId = field.getInt(action); } } if (type == 9 || type == 10) { text.put(viewId, value.toString()); } } System.out.println("title is: " + text.get(16908310)); System.out.println("info is: " + text.get(16909082)); System.out.println("text is: " + text.get(16908358)); } } catch (Exception e) { e.printStackTrace(); } </code></pre> <p>This code worked fine on a Nexus S with Android 4.0.3. However, I didn't test if it works on other versions of Android. It's very likely that some values, especially the viewId changed. I think there should be ways to support all versions of Android without hard-coding all possible ids, but that's the answer to another question... ;)</p> <p>PS: The value you're looking for (referring to as "(3)" in your original question) is the "text"-value.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload