Jump to content

Afficher variable dans widget


Recommended Posts

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.

Link to comment
Share on other sites

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);

Link to comment
Share on other sites

  • 4 weeks later...

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...