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

Android Discussion :

TabHost erreur non trouver


Sujet :

Android

  1. #1
    Candidat au Club
    Profil pro
    Inscrit en
    Avril 2012
    Messages
    10
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2012
    Messages : 10
    Points : 4
    Points
    4
    Par défaut
    voila depuis hier j'essaye différente solution mais sans résultat je suis bloquer sur la conception d'un tab host
    je ne trouve pas mon erreur

    eclipse me dit que tout est bon mais quand je lance une simulation j'ai un Fc


    dans mon main.java j'ai


    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
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    package com.formation.tabhost;
     
    import android.app.Activity;
    import android.os.Bundle;
    import android.widget.TabHost;
    import android.widget.TabHost.TabSpec;
     
    public class ActiviteTab extends Activity {
     
    	private TabHost monTabHost;
    	@Override
     
    	public void onCreate(Bundle savedInstanceState) {
     
    	super.onCreate(savedInstanceState);
     
    	setContentView(R.layout.main);
     
     
     
     
     
     
    	monTabHost =(TabHost) findViewById(R.id.TabHost01);
     
     
    	monTabHost.setup();
     
     
     
    	TabSpec spec = monTabHost.newTabSpec("onglet_1");
     
     
     
    	spec.setIndicator("Onglet 1",getResources().getDrawable(R.drawable.icon));
     
     
     
    	monTabHost.addTab(spec);
     
     
     
     
    	monTabHost.addTab(monTabHost.newTabSpec("onglet_2").setIndicator(  "Onglet 2").setContent(R.id.Onglet2));
     
    	monTabHost.addTab(monTabHost.newTabSpec("onglet_3").setIndicator(  "Onglet 3").setContent(R.id.Onglet3));
     
     
     
     
    	monTabHost.setOnTabChangedListener(
     
     
    	new TabHost.OnTabChangeListener (){
     
    	public void onTabChanged(String tabId){
     
     
     
    				}
     
    				}
     
    				);
     
    				}
     
    				}

    dans mon layout/main.xml

    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
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    <?xml version="1.0" encoding="utf-8"?>
     
    <LinearLayout
     
    xmlns:android="http://schemas.android.com/apk/res/android"
     
    android:layout_width="fill_parent"
     
    android:layout_height="fill_parent">
     
     
     
    <TabHost
     
    android:id="@+id/TabHost01"
     
    android:layout_width="fill_parent"
     
    android:layout_height="fill_parent">
     
    <LinearLayout
     
    android:orientation="vertical"
     
    android:layout_width="fill_parent"
     
    android:layout_height="fill_parent">
     
     
     
    <TabWidget android:id="@android:id/tabs"
     
    android:layout_width="fill_parent"
     
    android:layout_height="wrap_content">
     
    </TabWidget>
     
     
     
    <FrameLayout
     
    android:id="@android:id/tabcontent"
     
    android:layout_width="fill_parent"
     
    android:layout_height="fill_parent">
     
     
     
    <LinearLayout
     
    android:orientation="vertical"
     
    android:layout_width="fill_parent"
     
    android:layout_height="fill_parent"
     
    android:scrollbars="vertical"
     
    android:id="@+id/Onglet1">
     
    <TextView
     
    android:text="Ceci est un texte dans l’onglet 1"
     
    android:id="@+id/TextViewOnglet1"
     
    android:layout_width="wrap_content"
     
    android:layout_height="wrap_content">
     
    </TextView>
     
    </LinearLayout>
     
     
     
    <LinearLayout
     
    android:orientation="vertical"
     
    android:layout_width="fill_parent"
     
    android:layout_height="fill_parent"
     
    android:id="@+id/Onglet2">
     
    <TextView
     
    android:text="Ceci est un texte dans l’onglet 2"
     
    android:id="@+id/TextViewOnglet2"
     
    android:layout_width="wrap_content"
     
    android:layout_height="wrap_content">
     
    </TextView>
     
    <ImageView
     
    android:id="@+id/ImageView01"
     
    android:layout_width="wrap_content"
     
    android:layout_height="wrap_content"
     
    android:src="@drawable/icon">
     
    </ImageView>
     
    </LinearLayout>
     
     
     
    <LinearLayout
     
    android:orientation="vertical"
     
    android:layout_width="fill_parent"
     
    android:layout_height="fill_parent"
     
    android:id="@+id/Onglet3">
     
    <TextView
     
    android:text="Ceci est un texte dans l’onglet 3"
     
    android:id="@+id/TextViewOnglet3"
     
    android:layout_width="wrap_content"
     
    android:layout_height="wrap_content">
     
    </TextView>
     
    </LinearLayout>
     
    </FrameLayout>
     
    </LinearLayout>
     
    </TabHost>
     
    </LinearLayout>    
     
        [/quote]
    Mon layout/tab
     
    <div class="bbcode_container">
    	<div class="bbcode_quote">
    		<div class="quote_container">
    			<div class="bbcode_quote_container"></div>
     
    				<?xml version="1.0" encoding="utf-8"?>
     
    	<LinearLayout
    	xmlns:android="http://schemas.android.com/apk/res/android"
    	android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
     
    	<TextView
    	android:id="@+id/monTextView"
    	android:text="Coucou"
    	android:layout_width="fill_parent"
    	android:layout_height="fill_parent"
    	android:gravity="center_vertical|center_horizontal"/>
     
    	</LinearLayout>
     
    		</div>
    	</div>
    </div>et mon android manifest
     
    [quote]<?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.formation.tabhost"
        android:versionCode="1"
        android:versionName="1.0" >
     
        <uses-sdk android:minSdkVersion="15" />
     
        <activity android:name="ActiviteTab"></activity>
     
     
        <application
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name" >
            <activity android:name=".ActiviteTab"
     
    	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>
    au final j'essaye de faire ceci


  2. #2
    Modérateur
    Avatar de Hizin
    Homme Profil pro
    Développeur mobile
    Inscrit en
    Février 2010
    Messages
    2 180
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France

    Informations professionnelles :
    Activité : Développeur mobile

    Informations forums :
    Inscription : Février 2010
    Messages : 2 180
    Points : 5 072
    Points
    5 072
    Par défaut
    Au vu du nom de ton TabHost, je te suggère très fortement de lire l'erreur présente dans le LogCat, celle-ci te dira comment la résoudre (c'est-y pas beau ça, une erreur qui indique comment la corriger ?).

  3. #3
    Candidat au Club
    Profil pro
    Inscrit en
    Avril 2012
    Messages
    10
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2012
    Messages : 10
    Points : 4
    Points
    4
    Par défaut
    oui j'ai trouver le poste avec l'erreur google
    quel arrachage de cheveux
    ca marche enfin, Merci

Discussions similaires

  1. erreur latex fichier log non trouver
    Par manel mira dans le forum Débuter
    Réponses: 6
    Dernier message: 22/04/2015, 22h30
  2. erreur non comprise cherche solution
    Par debC++ dans le forum C++
    Réponses: 12
    Dernier message: 17/06/2005, 16h11
  3. [FORMS][6i] Erreur non explicitée
    Par badara1 dans le forum Forms
    Réponses: 15
    Dernier message: 13/05/2005, 10h56
  4. [ADO-Access] ADOQuery1.Open (SELECT) -> Erreur non spécif
    Par david_chardonnet dans le forum Bases de données
    Réponses: 3
    Dernier message: 10/11/2004, 15h29

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