Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>What you need to do is register a custom intent, for example ACTION_TEXT_CHANGED in your AppWidgetProvider like this for example:</p> <pre><code>public static final String ACTION_TEXT_CHANGED = "yourpackage.TEXT_CHANGED"; </code></pre> <p>After this, you need to register in your AndroidManifest.xml that you want to receive this intents in the intent-filter section of your receiver tag like this:</p> <pre><code>&lt;receiver android:name=".DrinkWaterAppWidgetProvider"&gt; &lt;intent-filter&gt; &lt;action android:name="android.appwidget.action.APPWIDGET_UPDATE" /&gt; &lt;action android:name="yourpackage.TEXT_CHANGED" /&gt; &lt;/intent-filter&gt; &lt;meta-data android:name="android.appwidget.provider" android:resource="@xml/appwidget_info" /&gt; &lt;/receiver&gt; </code></pre> <p>Then you have to extend the onReceive method in your AppWidgetProvider and make sure that you're handling your intent like this:</p> <pre><code>@Override public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); if (intent.getAction().equals(ACTION_TEXT_CHANGED)) { // handle intent here String s = intent.getStringExtra("NewString"); } } </code></pre> <p>After all the above is set up, you just need to broadcast the intent in your activity after the text has changed like this:</p> <pre><code>Intent intent = new Intent(YourAppWidgetProvider.ACTION_TEXT_CHANGED); intent.putExtra("NewString", textView.getText().toString()); getApplicationContext().sendBroadcast(intent); </code></pre> <p>Where "NewString" should be changed to the name you to give the the string.</p> <p>I hope it helps.</p>
    singulars
    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. 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.
    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