Aller au contenu
View in the app

A better way to browse. Learn more.

Forum de Frandroid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Afficher variable dans widget

Featured Replies

Posté(e)

Voilà mon problème:

Je commence la programmation Android, j'ai déjà quelque base java et je suis entrain de développer un wdget.

Mais je me trouve confronté à un problème dont je ne trouve pas la solution:

J'ai une variable (String) qui prends diverses phrases, de là je voudrais l'afficher dans mon widget.

J'ai donc un TextView et un androit:text

Mais là je na sais pas où se trouve ma variable.

Je voudrais donc savoir où est son emplacement ou tout du moins l'afficher.

Posté(e)

Si toi même tu ne sais pas où se trouve ta variable, on ne va pas pouvoir t'aider... ;)

Tu veux faire quoi ? Afficher, en Java, un texte dans un TextView ?

Si oui:

String monText = ...
TextView tv = (TextView)findViewById(R.id.Id_de_mon_textview);
tv.setText(monTexte);

  • 4 weeks later...
Posté(e)
  • Auteur

Je développe un widget. La variable est obtenu dans le code java. Mais je veux l'afficher dans mon widget.

Je connais la méthode: @strings/test mais je ne peux pas afficher une variable. juste une caine de caractère.

Dans le code que tu m'as donner, où je définis l'ID de mon text view?

Merci.

Posté(e)
  • Auteur

Je regarderai ça à partir de mercredi.

J'ai pas de quoi développer sur cet ordinateur...

Rejoignez la conversation

Vous pouvez poster maintenant et vous enregistrez plus tard. Si vous avez un compte, connectez-vous maintenant pour poster.

Invité
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Répondre à ce sujet…

Account

Navigation

Rechercher

Rechercher

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.