IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Composants graphiques Android Discussion :

Ajouter une "note" sur une webview


Sujet :

Composants graphiques Android

  1. #21
    Rédacteur
    Avatar de Viish
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Février 2009
    Messages
    427
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Février 2009
    Messages : 427
    Par défaut
    Citation Envoyé par Feanorin Voir le message
    Un bon tutoriel sur les Widgets, fait par notre célèbre Viish .
    Tu me flattes Feanorin !

    Sinon je suis du même avis que toi, le meilleur moyen d'intégrer un "appWidget" dans l'application consiste a l'insérer dans l'application "à la main". Le design d'un appWidget se faisant également par le biais d'un fichier layout .xml classique, tu devrais t'y retrouver assez rapidement. Seul le code behind devra changer un peu pour se comporter non plus comme un appWidget mais comme un composant de l'application.

    Et je ne pense pas possible la réutilisation d'un appWidget d'une autre application.

  2. #22
    Invité
    Invité(e)
    Par défaut
    Citation Envoyé par Viish Voir le message
    le meilleur moyen d'intégrer un "appWidget" dans l'application consiste a l'insérer dans l'application "à la main". Le design d'un appWidget se faisant également par le biais d'un fichier layout .xml classique, tu devrais t'y retrouver assez rapidement. Seul le code behind devra changer un peu pour se comporter non plus comme un appWidget mais comme un composant de l'application.
    Ok merci pour le conseil je vais donc essayer d'appliquer ton tuto à mon appli =) Parce que si j'ai bien compris ton tuto, il affiche les appWidget sur l'écran d'acceuil et pas dans une appli c'est ça?
    Si je met ce code dans une appli comportant déja un layout, en le modifiant je devrais pouvoir afficher un appWidget sur mon layout non?

  3. #23
    Rédacteur
    Avatar de Viish
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Février 2009
    Messages
    427
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Février 2009
    Messages : 427
    Par défaut
    En effet, mais du coup ça n'a plus grand chose à voir avec un appWidget ^^

  4. #24
    Invité
    Invité(e)
    Par défaut
    J'ai essayé de refaire ton tuto afin de mieux le comprendre, et j'ai un problème lorsque j'essai d'afficher l'appWidget. Lorsque je clique sur l'écran, je choisi widget, j'ai bien appWidget dans la liste, je le choisi et la j'ai un message qui me dit "l'application n'est pas installé sur votre téléphone" avec le logcat suivant :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    07-21 09:13:25.964: ERROR/Launcher(115): Launcher does not have the permission to launch Intent { act=android.appwidget.action.APPWIDGET_CONFIGURE cmp=com.appwidget/.ConfigurationWidgetActivity (has extras) }. Make sure to create a MAIN intent-filter for the corresponding activity or use the exported attribute for this activity.
    07-21 09:13:25.964: ERROR/Launcher(115): java.lang.SecurityException: Permission Denial: starting Intent { act=android.appwidget.action.APPWIDGET_CONFIGURE cmp=com.appwidget/.ConfigurationWidgetActivity (has extras) } from ProcessRecord{450d3160 115:com.android.launcher/10025} (pid=115, uid=10025) requires null
    07-21 09:13:25.964: ERROR/Launcher(115):     at android.os.Parcel.readException(Parcel.java:1247)
    07-21 09:13:25.964: ERROR/Launcher(115):     at android.os.Parcel.readException(Parcel.java:1235)
    07-21 09:13:25.964: ERROR/Launcher(115):     at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:1298)
    07-21 09:13:25.964: ERROR/Launcher(115):     at android.app.Instrumentation.execStartActivity(Instrumentation.java:1373)
    07-21 09:13:25.964: ERROR/Launcher(115):     at android.app.Activity.startActivityForResult(Activity.java:2817)
    07-21 09:13:25.964: ERROR/Launcher(115):     at com.android.launcher2.Launcher.startActivityForResult(Launcher.java:1053)
    07-21 09:13:25.964: ERROR/Launcher(115):     at com.android.launcher2.Launcher.startActivityForResultSafely(Launcher.java:1477)
    07-21 09:13:25.964: ERROR/Launcher(115):     at com.android.launcher2.Launcher.addAppWidget(Launcher.java:1185)
    07-21 09:13:25.964: ERROR/Launcher(115):     at com.android.launcher2.Launcher.onActivityResult(Launcher.java:539)
    07-21 09:13:25.964: ERROR/Launcher(115):     at android.app.Activity.dispatchActivityResult(Activity.java:3890)
    07-21 09:13:25.964: ERROR/Launcher(115):     at android.app.ActivityThread.deliverResults(ActivityThread.java:3511)
    07-21 09:13:25.964: ERROR/Launcher(115):     at android.app.ActivityThread.handleSendResult(ActivityThread.java:3557)
    07-21 09:13:25.964: ERROR/Launcher(115):     at android.app.ActivityThread.access$2800(ActivityThread.java:125)
    07-21 09:13:25.964: ERROR/Launcher(115):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2063)
    07-21 09:13:25.964: ERROR/Launcher(115):     at android.os.Handler.dispatchMessage(Handler.java:99)
    07-21 09:13:25.964: ERROR/Launcher(115):     at android.os.Looper.loop(Looper.java:123)
    07-21 09:13:25.964: ERROR/Launcher(115):     at android.app.ActivityThread.main(ActivityThread.java:4627)
    07-21 09:13:25.964: ERROR/Launcher(115):     at java.lang.reflect.Method.invokeNative(Native Method)
    07-21 09:13:25.964: ERROR/Launcher(115):     at java.lang.reflect.Method.invoke(Method.java:521)
    07-21 09:13:25.964: ERROR/Launcher(115):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
    07-21 09:13:25.964: ERROR/Launcher(115):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
    07-21 09:13:25.964: ERROR/Launcher(115):     at dalvik.system.NativeStart.main(Native Method)
    Je pense que celà vient de mon manifest mais je ne suis pas sure, dans le doute le voici :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.appwidget"
          android:versionCode="1"
          android:versionName="1.0">
     
     
        <application android:icon="@drawable/icon" android:label="@string/app_name">
        	<!-- Notre AppWidget -->
    		<receiver android:name="MonWidgetDeveloppez">
    			<intent-filter>
    				<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
    			</intent-filter>
    			<meta-data android:name="android.appwidget.provider" android:resource="@xml/widget_meta" />
    		</receiver>
        	<activity android:name="ConfigurationWidgetActivity"></activity>
        	<activity android:name=".appWidget"
                      android:label="@string/app_name">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
        </application>
    </manifest>

  5. #25
    Rédacteur
    Avatar de Viish
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Février 2009
    Messages
    427
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Février 2009
    Messages : 427
    Par défaut
    C'est normal, l'intent filter "Main" n'est pas appliqué à la bonne Activity.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.appwidget"
          android:versionCode="1"
          android:versionName="1.0">
     
     
        <application android:icon="@drawable/icon" android:label="@string/app_name">
        	<!-- Notre AppWidget -->
    		<receiver android:name="MonWidgetDeveloppez">
    			<intent-filter>
    				<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
    			</intent-filter>
    			<meta-data android:name="android.appwidget.provider" android:resource="@xml/widget_meta" />
    		</receiver>
        	<activity android:name="ConfigurationWidgetActivity">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
        	<activity android:name=".appWidget"
                      android:label="@string/app_name">
            </activity>
        </application>
    </manifest>

  6. #26
    Invité
    Invité(e)
    Par défaut
    J'ai fait ce changement mais toujours le même problème
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    07-21 09:24:37.374: ERROR/Launcher(115): Launcher does not have the permission to launch Intent { act=android.appwidget.action.APPWIDGET_CONFIGURE cmp=com.appwidget/.ConfigurationWidgetActivity (has extras) }. Make sure to create a MAIN intent-filter for the corresponding activity or use the exported attribute for this activity.
    07-21 09:24:37.374: ERROR/Launcher(115): java.lang.SecurityException: Permission Denial: starting Intent { act=android.appwidget.action.APPWIDGET_CONFIGURE cmp=com.appwidget/.ConfigurationWidgetActivity (has extras) } from ProcessRecord{450d3160 115:com.android.launcher/10025} (pid=115, uid=10025) requires null
    Dans le widget_meta j'ai remplacé le configure comme ceci :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
     android:configure="com.appwidget.ConfigurationWidgetActivity"
    Il fallait bien que je remplace par mon package?

  7. #27
    Invité
    Invité(e)
    Par défaut Ajouter un Widget "note" dans une application
    Bonjour, je me permet de revenir sur ce sujet car je cherche toujours à mettre des widget à l'intérieur de mon application, mais j'aimerais d'abord réussir à refaire le tutoriel de Viish ... et pour l'instant je bloque sur ce message qui s'affiche lorsque j'essai de créer l'appWidget :
    l'application n'est pas installé sur votre téléphone

    ----EDIT----
    J'ai recommencé le projet depuis le début et cette fois ça marche, je n'ai pas toruvé mon erreur mais je peux avancer, je vais faire la suite du tuto et puis je me lancerais dans l'adaptation de l'appWidget à ce que je veux faire!
    Dernière modification par Invité ; 22/07/2011 à 11h30.

  8. #28
    Invité
    Invité(e)
    Par défaut
    La deuxième partie de ce tuto : Aller plus loin avec son AppWidget
    Si j'ai bien compris elle permet de créer un widget sur le bureau mais à partir d'une application? et pas juste du texte (comme la partie précédente)?

    Donc si je veux, dans ma propre appli afficher un widget avec du texte, normalement il me suffit d'adapter la premiére partie de ce tuto?


    ----EDIT----
    J'ai essayé d'ajouter une zone d'édition de texte dans le widget, en mettant dans widget_layout ceci:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent">
      <TextView 
      	android:layout_width="wrap_content"
      	android:layout_height="wrap_content"
      	android:id="@+id/hello_word"
      	android:textColor="@android:color/black"/>
      <EditText 
      	android:layout_width="wrap_content"
      	android:layout_height="wrap_content"
      	android:textColor="@android:color/black"
      	android:id="@+id/edt"/>
    </LinearLayout>
    Mais j'affiche un widget avec à l'intérieur le message
    Problème lors du chargement du Widget
    et les warnings suivant :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    07-22 09:43:00.453: WARN/AppWidgetHostView(115): updateAppWidget couldn't find any view, using error view
    07-22 09:43:00.453: WARN/AppWidgetHostView(115): android.view.InflateException: Binary XML file line #11: Error inflating class android.widget.EditText
    07-22 09:43:00.453: WARN/AppWidgetHostView(115):     at android.view.LayoutInflater.createView(LayoutInflater.java:513)
    07-22 09:43:00.453: WARN/AppWidgetHostView(115):     at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
    07-22 09:43:00.453: WARN/AppWidgetHostView(115):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
    07-22 09:43:00.453: WARN/AppWidgetHostView(115):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
    07-22 09:43:00.453: WARN/AppWidgetHostView(115):     at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
    07-22 09:43:00.453: WARN/AppWidgetHostView(115):     at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
    07-22 09:43:00.453: WARN/AppWidgetHostView(115):     at android.widget.RemoteViews.apply(RemoteViews.java:930)
    07-22 09:43:00.453: WARN/AppWidgetHostView(115):     at android.appwidget.AppWidgetHostView.updateAppWidget(AppWidgetHostView.java:219)
    07-22 09:43:00.453: WARN/AppWidgetHostView(115):     at android.appwidget.AppWidgetHostView.updateAppWidget(AppWidgetHostView.java:155)
    07-22 09:43:00.453: WARN/AppWidgetHostView(115):     at android.appwidget.AppWidgetHost.createView(AppWidgetHost.java:218)
    07-22 09:43:00.453: WARN/AppWidgetHostView(115):     at com.android.launcher2.Launcher.completeAddAppWidget(Launcher.java:911)
    07-22 09:43:00.453: WARN/AppWidgetHostView(115):     at com.android.launcher2.Launcher.onActivityResult(Launcher.java:542)
    07-22 09:43:00.453: WARN/AppWidgetHostView(115):     at android.app.Activity.dispatchActivityResult(Activity.java:3890)
    07-22 09:43:00.453: WARN/AppWidgetHostView(115):     at android.app.ActivityThread.deliverResults(ActivityThread.java:3511)
    07-22 09:43:00.453: WARN/AppWidgetHostView(115):     at android.app.ActivityThread.handleSendResult(ActivityThread.java:3557)
    07-22 09:43:00.453: WARN/AppWidgetHostView(115):     at android.app.ActivityThread.access$2800(ActivityThread.java:125)
    07-22 09:43:00.453: WARN/AppWidgetHostView(115):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2063)
    07-22 09:43:00.453: WARN/AppWidgetHostView(115):     at android.os.Handler.dispatchMessage(Handler.java:99)
    07-22 09:43:00.453: WARN/AppWidgetHostView(115):     at android.os.Looper.loop(Looper.java:123)
    07-22 09:43:00.453: WARN/AppWidgetHostView(115):     at android.app.ActivityThread.main(ActivityThread.java:4627)
    07-22 09:43:00.453: WARN/AppWidgetHostView(115):     at java.lang.reflect.Method.invokeNative(Native Method)
    07-22 09:43:00.453: WARN/AppWidgetHostView(115):     at java.lang.reflect.Method.invoke(Method.java:521)
    07-22 09:43:00.453: WARN/AppWidgetHostView(115):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
    07-22 09:43:00.453: WARN/AppWidgetHostView(115):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
    07-22 09:43:00.453: WARN/AppWidgetHostView(115):     at dalvik.system.NativeStart.main(Native Method)
    07-22 09:43:00.453: WARN/AppWidgetHostView(115): Caused by: android.view.InflateException: Binary XML file line #11: Class not allowed to be inflated android.widget.EditText
    07-22 09:43:00.453: WARN/AppWidgetHostView(115):     at android.view.LayoutInflater.failNotAllowed(LayoutInflater.java:525)
    07-22 09:43:00.453: WARN/AppWidgetHostView(115):     at android.view.LayoutInflater.createView(LayoutInflater.java:472)
    07-22 09:43:00.453: WARN/AppWidgetHostView(115):     ... 24 more
    07-22 09:43:00.463: WARN/InputManagerService(58): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@44ffd0e8
    07-22 09:43:00.483: WARN/AppWidgetHostView(115): updateAppWidget couldn't find any view, using error view
    07-22 09:43:00.483: WARN/AppWidgetHostView(115): android.view.InflateException: Binary XML file line #11: Error inflating class android.widget.EditText
    07-22 09:43:00.483: WARN/AppWidgetHostView(115):     at android.view.LayoutInflater.createView(LayoutInflater.java:513)
    07-22 09:43:00.483: WARN/AppWidgetHostView(115):     at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
    07-22 09:43:00.483: WARN/AppWidgetHostView(115):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
    07-22 09:43:00.483: WARN/AppWidgetHostView(115):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
    07-22 09:43:00.483: WARN/AppWidgetHostView(115):     at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
    07-22 09:43:00.483: WARN/AppWidgetHostView(115):     at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
    07-22 09:43:00.483: WARN/AppWidgetHostView(115):     at android.widget.RemoteViews.apply(RemoteViews.java:930)
    07-22 09:43:00.483: WARN/AppWidgetHostView(115):     at android.appwidget.AppWidgetHostView.updateAppWidget(AppWidgetHostView.java:219)
    07-22 09:43:00.483: WARN/AppWidgetHostView(115):     at android.appwidget.AppWidgetHost.updateAppWidgetView(AppWidgetHost.java:250)
    07-22 09:43:00.483: WARN/AppWidgetHostView(115):     at android.appwidget.AppWidgetHost$UpdateHandler.handleMessage(AppWidgetHost.java:73)
    07-22 09:43:00.483: WARN/AppWidgetHostView(115):     at android.os.Handler.dispatchMessage(Handler.java:99)
    07-22 09:43:00.483: WARN/AppWidgetHostView(115):     at android.os.Looper.loop(Looper.java:123)
    07-22 09:43:00.483: WARN/AppWidgetHostView(115):     at android.app.ActivityThread.main(ActivityThread.java:4627)
    07-22 09:43:00.483: WARN/AppWidgetHostView(115):     at java.lang.reflect.Method.invokeNative(Native Method)
    07-22 09:43:00.483: WARN/AppWidgetHostView(115):     at java.lang.reflect.Method.invoke(Method.java:521)
    07-22 09:43:00.483: WARN/AppWidgetHostView(115):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
    07-22 09:43:00.483: WARN/AppWidgetHostView(115):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
    07-22 09:43:00.483: WARN/AppWidgetHostView(115):     at dalvik.system.NativeStart.main(Native Method)
    07-22 09:43:00.483: WARN/AppWidgetHostView(115): Caused by: android.view.InflateException: Binary XML file line #11: Class not allowed to be inflated android.widget.EditText
    07-22 09:43:00.483: WARN/AppWidgetHostView(115):     at android.view.LayoutInflater.failNotAllowed(LayoutInflater.java:525)
    07-22 09:43:00.483: WARN/AppWidgetHostView(115):     at android.view.LayoutInflater.createView(LayoutInflater.java:472)
    07-22 09:43:00.483: WARN/AppWidgetHostView(115):     ... 17 more
    Comment faire pour afficher cette éditText? et est-ce possible? Un appWidget est quelquechose que l'on affiche et pas quelque chose que l'on modifie nest-ce pas? Mais si on ne peut pas le modifier alors ce il n'est pas intéréssant pour moi de l'intégrer à mon application.
    Dernière modification par Invité ; 25/07/2011 à 09h05.

  9. #29
    Invité
    Invité(e)
    Par défaut
    Personne ne sait comment faire? est-ce que c'est possible d'éditer un appwidget? il me semble que justement ça serve à afficher quelquechose de "constant" et du coup je me dit qu'il est peut-être impossible pour l'utilisateur d'éditer un widget comme s'il s'agissait "d'une note".

+ Répondre à la discussion
Cette discussion est résolue.
Page 2 sur 2 PremièrePremière 12

Discussions similaires

  1. Réponses: 0
    Dernier message: 07/12/2007, 13h12
  2. Requete SUM sur une table avec critère sur une autre
    Par wail00 dans le forum Langage SQL
    Réponses: 3
    Dernier message: 21/05/2007, 16h58
  3. [Access] Requête sur une table et tri sur une autre
    Par VooDooS dans le forum Langage SQL
    Réponses: 2
    Dernier message: 30/08/2006, 15h07

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo