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 :

code non exécutable( id cannot be resolved or is not a field)


Sujet :

Android

  1. #1
    Futur Membre du Club
    Femme Profil pro
    Étudiant
    Inscrit en
    Mai 2012
    Messages
    2
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Service public

    Informations forums :
    Inscription : Mai 2012
    Messages : 2
    Points : 5
    Points
    5
    Par défaut code non exécutable( id cannot be resolved or is not a field)
    Bonjour tout le monde je m'entraine sur la programmation java android j'ai voulu essayer un code source mais beaucoup de choses manquent !
    Pouvez vous me corriger ce code en ajoutant ce qui manque voici le code java:

    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
    package com.projet.EsaiPlanning;
     
    import android.app.Activity;
    import android.os.Bundle;
     
     
     
    import android.content.Context;
    import android.content.Intent;
    import android.content.pm.ActivityInfo;
     
    import android.view.LayoutInflater;
    import android.view.Menu;
    import android.view.MenuInflater;
    import android.view.MenuItem;
    import android.view.View;
    import android.widget.ArrayAdapter;
    import android.widget.Spinner;
    import android.widget.TabHost;
    import android.widget.TabHost.TabSpec;
    import android.widget.TextView;
     
    public class DisplayEdtActivity extends Activity {
     
    	private TabHost tabHost; 
    	private TabSpec tabSpec;
        @SuppressWarnings({ "unchecked", "rawtypes" })
    	public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
            boolean test;
            try {
            	 test = OptionsActivity.ACCMETRE.isChecked();
            }
            catch (NullPointerException e){
            	test=true;
            }
            if(!test){
            	setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
            }
     
            Spinner choixFormationBis = (Spinner) findViewById(R.id.choixFormationBis);
            ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item);
            adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
            adapter.add("IR1");
            adapter.add("IR2");
            adapter.add("IR3");
            adapter.add("SEP1");
            adapter.add("SEP2");
            adapter.add("SEP3");
            adapter.add("CPI1");
            adapter.add("CPI2");
            adapter.add("CPI3");
            choixFormationBis.setAdapter(adapter);
     
     
            Intent intent = new Intent(this, OngletsActivity.class);
            tabHost = getTabHost();
     
     
           intent.putExtra("valeur", "Emploi du temps de Lundi");
     
            tabSpec = tabHost.newTabSpec("lundi").setIndicator(createTabView(this,"Lundi")).setContent(intent);
            tabHost.addTab(tabSpec);
     
            intent = new Intent(this, OngletsActivity.class);
            intent.putExtra("valeur", "Emploi du temps de Mardi");
            tabSpec = tabHost.newTabSpec("mardi").setIndicator(createTabView(this,"Mardi")).setContent(intent);
            tabHost.addTab(tabSpec);
     
            intent = new Intent(this, OngletsActivity.class);
            intent.putExtra("valeur", "Emploi du temps de Mercredi");
     
            tabSpec = tabHost.newTabSpec("mercredi").setIndicator(createTabView(this,"Mercredi")).setContent(intent);
            tabHost.addTab(tabSpec);
     
            intent = new Intent(this, OngletsActivity.class);
            intent.putExtra("valeur", "Emploi du temps de Jeudi");
            tabSpec = tabHost.newTabSpec("jeudi").setIndicator(createTabView(this,"Jeudi")).setContent(intent);
            tabHost.addTab(tabSpec);
     
            intent = new Intent(this, OngletsActivity.class);
            intent.putExtra("valeur", "Emploi du temps de Vendredi");
     
            tabSpec = tabHost.newTabSpec("vendredi").setIndicator(createTabView(this,"Vendredi")).setContent(intent);
            tabHost.addTab(tabSpec);
     
     
     
        }
     
        private TabHost getTabHost() {
    		// TODO Auto-generated method stub
    		return null;
    	}
     
    	private static View createTabView(final Context context, final String text) {
            View view = LayoutInflater.from(context).inflate(R.layout.onglets_semaine, null);
            TextView tv = (TextView) view.findViewById(R.id.contenu);
            tv.setText(text);
            return view;
        }
     
        public boolean onCreateOptionsMenu(Menu menu) {
        	MenuInflater inflater = getMenuInflater();
        	inflater.inflate(R.layout.options_menu, menu);
        	return true;
        }
     
        public boolean onOptionsItemSelected(MenuItem item) {
        	switch (item.getItemId()) {
    	    	case R.id.credits:
    	    		Intent openStartingPoint1 = new Intent("com.projet.EsaiPlanning.CREDITSACTIVITY");
    				startActivity(openStartingPoint1);
    	    		return true;
    	    	case R.id.options:
    	    		Intent openStartingPoint2 = new Intent("com.projet.EsaiPlanning.OPTIONSACTIVITY");
    				startActivity(openStartingPoint2);
    	    		return true;
    	    	default:
    	    		return super.onOptionsItemSelected(item);
        	}
        }
     
    }
    et ceci est le code 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
    <?xml version="1.0" encoding="utf-8"?>
     
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" 
        android:background="@drawable/background">
     
        <LinearLayout 
    	    android:orientation="horizontal"
    	    android:layout_width="fill_parent"
    	    android:background="@drawable/background"
    	    android:layout_height="62dp"
    	    >
     
    		<Spinner android:id="@+id/choixFormationBis"
    				 android:layout_height="wrap_content" 
    				 android:layout_width="wrap_content"
    				  android:layout_marginLeft="160dp" 
     
    				 android:layout_gravity="center_vertical|center_horizontal">
    		</Spinner>
     
    		<Button android:layout_height="wrap_content" 
     				android:layout_width="wrap_content" 
     				android:text="@string/Afficher" 
    				android:id="@+id/goEdtBis"
     				android:layout_gravity="center_vertical|center_horizontal">
     		</Button>
     
    	</LinearLayout>
     
    	<LinearLayout 
    	    android:orientation="horizontal"
    	    android:layout_width="fill_parent"
    	     android:layout_height="60dp"
    	    android:background="@drawable/background"
    	   >
     
    		<Button android:layout_height="wrap_content" 
    				android:layout_width="wrap_content" 
    				android:text="" 
    				android:id="@+id/semainePrec"
    				android:layout_gravity="center_vertical|center_horizontal"
    				android:background="@drawable/left"
    				android:layout_marginRight="80dp">
    		</Button>
     
    		<TextView android:layout_height="wrap_content"
    				  android:layout_width="wrap_content"
    				  android:text="@string/Semaine du 12/09 au 17/09"
    				  android:textSize="20dp"
    				  android:id="@+id/semaine">
    		</TextView>
     
    		<Button android:layout_height="wrap_content" 
    		 		android:layout_width="wrap_content" 
    		 		android:text="" 
    		 		android:id="@+id/semaineSuiv"
    		 		android:layout_gravity="center_vertical|center_horizontal"
    		 		android:background="@drawable/right"
    		 		android:layout_marginLeft="75dp">
    		</Button>
     
    	</LinearLayout>
     
    	<TabHost
    	xmlns:android="http://schemas.android.com/apk/res/android"
    	android:id="@android:id/tabhost"
    	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"
     
    	 />
     
    	<FrameLayout
    	android:id="@android:id/tabcontent"
    	android:layout_width="fill_parent"
    	android:layout_height="fill_parent"
     
    	>
     
    	</FrameLayout>
    	</LinearLayout> 
    	</TabHost>
     
    </LinearLayout>

  2. #2
    Expert éminent

    Avatar de Feanorin
    Profil pro
    Inscrit en
    Avril 2004
    Messages
    4 589
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 4 589
    Points : 9 149
    Points
    9 149
    Par défaut
    Bonjour tout le monde je m'entraine sur la programmation java android j'ai voulu essayer un code source mais beaucoup de choses manquent !
    Pouvez vous me corriger ce code en ajoutant ce qui manque voici le code java:
    Avant de nous demander à faire ton travail, cela serait sympa que tu passes un peu de temps dessus.

    Donne nous ton rapport d'erreur ou ce que tu n'arrive spas à faire précisément.

    Merci .
    Responsable Android de Developpez.com (Twitter et Facebook)
    Besoin d"un article/tutoriel/cours sur Android, consulter la page cours
    N'hésitez pas à consulter la FAQ Android et à poser vos questions sur les forums d'entraide mobile d'Android.

Discussions similaires

  1. Réponses: 2
    Dernier message: 23/03/2015, 19h19
  2. Erreur "ECLIPSELINK_PERSISTENCE_XML cannot be resolved or is not a field"
    Par midolarche dans le forum Développement Web en Java
    Réponses: 0
    Dernier message: 28/12/2013, 17h09
  3. Main cannot be resolved or is not a field
    Par poutch dans le forum Android
    Réponses: 4
    Dernier message: 02/08/2011, 10h11
  4. [VBNET--VS2003] Partie de code non exécuté
    Par shadowninja dans le forum Windows Forms
    Réponses: 1
    Dernier message: 27/02/2007, 17h28

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