2016-04-27 19 views
1

私のアプリケーションをテストしようとすると、エラーが発生します。

致命的な例外:メインプロセス:com.example.android.lab5、PID:12261 android.content.res.Resources $ NotFoundException:文字列リソースのID番号の0x2の

はここに私のコード

です
public class MainActivity extends AppCompatActivity {  
    private Spinner spinnerVille; 
    private TextView ville; 
    private ListView lstJours; 
    int posVille = 0;  

    // Les items 
    private ArrayList<Jour> mJours = new ArrayList<Jour>(); 

    // L'adapteur 
    private JourAdapteur mJoursAdapteur; 

    private List<MeteoJour> meteojours; 

    public static final int REQUEST_TEXT = 0; 
    public int laPosition = 0; 
    /** 
    * ATTENTION: This was auto-generated to implement the App Indexing API. 
    * See https://g.co/AppIndexing/AndroidStudio for more information. 
    */ 
    private GoogleApiClient client; 

    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_main); 

     final DatabaseHandler db = new DatabaseHandler(this);  

     Log.d("Insert: ", "Inserting .."); 
     /*db.addMeteoJours(new MeteoJour(1, 2, 5, -2, 10, "SO", 8, 15, 1, 0)); 
     db.addMeteoJours(new MeteoJour(2, -1, 3, -4, 5, "NO", 8, 30, 0, 2)); 
     db.addMeteoJours(new MeteoJour(3, 2, 6, 1, 2, "SO", 8, 20, 2, 0)); 
     db.addMeteoJours(new MeteoJour(4, 3, 6, 3, 10, "SE", 8, 0, 0, 0)); 
     db.addMeteoJours(new MeteoJour(5, 4, 5, 4, 350, "S", 8, 30, 4, 0)); 
     db.addMeteoJours(new MeteoJour(6, 4, 7, 5, 0, "O", 8, 0, 0, 0)); 
     db.addMeteoJours(new MeteoJour(7, 6, 8, 8, 10, "E", 9, 15, 1, 0)); 
     db.addMeteoJours(new MeteoJour(8, 4, 5, 4, 350, "S", 8, 30, 4, 0));; 
     db.addMeteoJours(new MeteoJour(9, 2, 5, -2, 10, "SO", 8, 15, 1, 0)); 
     db.addMeteoJours(new MeteoJour(10, 2, 5, -2, 10, "SO", 8, 15, 1, 0)); 
     db.addMeteoJours(new MeteoJour(11, 2, 5, -2, 10, "SO", 8, 15, 1, 0)); 
     db.addMeteoJours(new MeteoJour(12, 6, 8, 8, 10, "E", 9, 15, 1, 0)); 
     db.addMeteoJours(new MeteoJour(13, 2, 5, -2, 10, "SO", 8, 15, 1, 0)); 
     db.addMeteoJours(new MeteoJour(14, 6, 8, 8, 10, "E", 9, 15, 1, 0)); 
     db.addMeteoJours(new MeteoJour(15, 4, 5, 4, 350, "S", 8, 30, 4, 0)); 
     db.addMeteoJours(new MeteoJour(16, 2, 5, -2, 10, "SO", 8, 15, 1, 0)); 
     db.addMeteoJours(new MeteoJour(17, 2, 5, -2, 10, "SO", 8, 15, 1, 0)); 
     db.addMeteoJours(new MeteoJour(18, 4, 5, 4, 350, "S", 8, 30, 4, 0)); 
     db.addMeteoJours(new MeteoJour(19, 6, 8, 8, 10, "E", 9, 15, 1, 0)); 
     db.addMeteoJours(new MeteoJour(20, 2, 5, -2, 10, "SO", 9, 15, 1, 0)); 
     db.addMeteoJours(new MeteoJour(21, -1, 3, -4, 5, "NO", 9, 30, 0, 2)); 
     db.addMeteoJours(new MeteoJour(22, 2, 5, 2, 10, "SO", 8, 15, 1, 0)); 
     db.addMeteoJours(new MeteoJour(23, 2, 5, 2, 10, "SO", 8, 15, 1, 0)); 
     db.addMeteoJours(new MeteoJour(24, 2, 5, 2, 10, "SO", 8, 15, 1, 0)); 
     db.addMeteoJours(new MeteoJour(25, 2, 5, 2, 10, "SO", 8, 15, 1, 0)); 
     db.addMeteoJours(new MeteoJour(26, 6, 8, 8, 10, "E", 9, 15, 1, 0)); 
     db.addMeteoJours(new MeteoJour(27, 2, 5, 2, 10, "SO", 8, 15, 1, 0)); 
     db.addMeteoJours(new MeteoJour(28, 2, 5, 2, 10, "SO", 8, 15, 1, 0)); 
     db.addMeteoJours(new MeteoJour(29, 2, 6, 1, 2, "SO", 9, 20, 2, 0)); 
     db.addMeteoJours(new MeteoJour(30, 3, 6, 3, 10, "SE", 9, 0, 0, 0)); 
     db.addMeteoJours(new MeteoJour(31, 2, 5, -2, 10, "SO", 8, 15, 1, 0)); 
     db.addMeteoJours(new MeteoJour(32, 7, 10, 10, 10, "SO", 8, 15, 1, 0)); 
     db.addMeteoJours(new MeteoJour(33, 2, 5, 2, 10, "SO", 8, 15, 1, 0)); 
     db.addMeteoJours(new MeteoJour(34, 6, 8, 8, 10, "E", 9, 15, 1, 0)); 
     db.addMeteoJours(new MeteoJour(35, 2, 5, 2, 10, "SO", 8, 15, 1, 0));*/ 
     // Reading all contacts 
     Log.d("Reading: ", "Reading all meteojours.."); 
     //final List<Contact> contacts = db.getAllContacts(); 
     meteojours = db.getAllMeteoJours(); 

     for (MeteoJour cn : meteojours) { 
      mJours.add(new Jour((String.valueOf(cn.get_id()) + " Mars 2016"), cn.get_minimum(), cn.get_maximum())); 
      String log = "Id: " + cn.get_id() + " ,Minimum: " + cn.get_minimum() + " ,Maximum: " + cn.get_maximum(); 
      // Writing to log 
      Log.d("Name: ", log); 
     }  

     spinnerVille = (Spinner) findViewById(R.id.spinnerVille); 
     ville = (TextView) findViewById(R.id.Ville); 
     lstJours = (ListView) findViewById(R.id.lstJours);  

     // Adapteur 
     //mHerosAdapteur = new HeroAdapteur(this, MonSingleton.getInstance().getHeros()); 
     mJoursAdapteur = new JourAdapteur(this, mJours); 

     // Assigner l'adapteur à la liste 
     lstJours.setAdapter(mJoursAdapteur);  

     // Create an ArrayAdapter using the string array and a default spinner layout 
     ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, 
       R.array.villes, android.R.layout.simple_spinner_item); 
     // Specify the layout to use when the list of choices appears 
     adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); 
     spinnerVille.setAdapter(adapter); 

     spinnerVille.setOnItemSelectedListener(new OnItemSelectedListener() { 
      @Override 
      public void onItemSelected(AdapterView<?> adapter, View v, int position, long id) { 

       switch (position) { 
        case 0: 
         ville.setText("Gatineau"); 
         posVille = 0; 
         break; 
        case 1: 
         ville.setText("Trois-Rivière"); 
         posVille = 1; 
         break; 
        case 2: 
         ville.setText("Montréal"); 
         posVille = 2; 
         break; 
        case 3: 
         ville.setText("Sherbrooke"); 
         posVille = 3; 
         break; 
        case 4: 
         ville.setText("Alma"); 
         posVille = 4; 
         break; 
       }  
      } 

      public void onNothingSelected(AdapterView<?> parent) { 
       // Another interface callback 
      }  
     }); 

     //lstJours.setOnItemClickListener(new AdapterView.OnItemClickListener() { 

     lstJours.setOnItemClickListener(new AdapterView.OnItemClickListener() { 
      @Override 
      public void onItemClick(AdapterView<?> parent, View view, int position, long id) { 

       // La seconde activité 
       Intent intent = new Intent(MainActivity.this, Meteo.class); 
       // Les paramètres 

       meteojours = db.getAllMeteoJours(); 

       laPosition = position; 

       MeteoJour cn = meteojours.get(position); 
       // Les paramètres 
       intent.putExtra("Id", String.valueOf(cn.get_id())); 
       intent.putExtra("Min", cn.get_minimum()); 
       intent.putExtra("Max", cn.get_maximum()); 
       intent.putExtra("Ressentie", cn.get_ressentie()); 
       intent.putExtra("VitesseVent", cn.get_vent_vitesse()); 
       intent.putExtra("VetesseDirec", cn.get_vent_direction()); 
       intent.putExtra("Ensoleillement", cn.get_ensoleillement()); 
       intent.putExtra("Prob", cn.get_probabilite()); 
       intent.putExtra("Pluie", cn.get_pluie()); 
       intent.putExtra("Neige", cn.get_neige()); 
       intent.putExtra("villeslct", spinnerVille.getItemAtPosition(posVille).toString()); 
       intent.putExtra("joursslct", lstJours.getItemAtPosition(position).toString()); 
       startActivity(intent); 
       // Lancer la seconde activité 


      } 
     });  

     // ATTENTION: This was auto-generated to implement the App Indexing API. 
     // See https://g.co/AppIndexing/AndroidStudio for more information. 
     client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build(); 
    } 

    @Override 
    protected void onActivityResult(int requestCode, int resultCode, Intent data) { 

     if (requestCode == REQUEST_TEXT) { 
      if (resultCode == Meteo.RETURN_CODE_OK) { 
       //Toast.makeText(MainActivity.this, data.getStringExtra("prenom"), Toast.LENGTH_SHORT).show(); 
       mJours.add(new Jour(data.getStringExtra("date"), data.getIntExtra("minimum", 0), data.getIntExtra("maximum", 0))); 
       mJoursAdapteur.notifyDataSetChanged(); 
      } 
     }  
    } 

    @Override 
    public void onStart() { 
     super.onStart(); 

     // ATTENTION: This was auto-generated to implement the App Indexing API. 
     // See https://g.co/AppIndexing/AndroidStudio for more information. 
     client.connect(); 
     Action viewAction = Action.newAction(
       Action.TYPE_VIEW, // TODO: choose an action type. 
       "Main Page", // TODO: Define a title for the content shown. 
       // TODO: If you have web page content that matches this app activity's content, 
       // make sure this auto-generated web page URL is correct. 
       // Otherwise, set the URL to null. 
       Uri.parse("http://host/path"), 
       // TODO: Make sure this auto-generated app deep link URI is correct. 
       Uri.parse("android-app://com.example.android.lab5/http/host/path") 
     ); 
     AppIndex.AppIndexApi.start(client, viewAction); 
    } 

    @Override 
    public void onStop() { 
     super.onStop(); 

     // ATTENTION: This was auto-generated to implement the App Indexing API. 
     // See https://g.co/AppIndexing/AndroidStudio for more information. 
     Action viewAction = Action.newAction(
       Action.TYPE_VIEW, // TODO: choose an action type. 
       "Main Page", // TODO: Define a title for the content shown. 
       // TODO: If you have web page content that matches this app activity's content, 
       // make sure this auto-generated web page URL is correct. 
       // Otherwise, set the URL to null. 
       Uri.parse("http://host/path"), 
       // TODO: Make sure this auto-generated app deep link URI is correct. 
       Uri.parse("android-app://com.example.android.lab5/http/host/path") 
     ); 
     AppIndex.AppIndexApi.end(client, viewAction); 
     client.disconnect(); 
    } 
} 

私は自分のエラーを分離し、その行から来ているようだ:

mJours.add(new Jour((String.valueOf(cn.get_id()) + " Mars 2016"), cn.get_minimum(), cn.get_maximum())); 

私のJavaクラスJourのコードは次のとおりです。

public class Jour {  
    private int mTempMin; 
    private int mTempMax; 
    private String mDates; 

    public Jour(String date, int min, int max) { 
     mTempMin = min; 
     mTempMax = max; 
     mDates = date; 
    }  

    public String getmDates() { 
     return mDates; 
    } 

    public void setmDates(String mDates) { 
     this.mDates = mDates; 
    } 

    public int getmTempMin() { 
     return mTempMin; 
    } 

    public void setmTempMin(int mTempMin) { 
     this.mTempMin = mTempMin; 
    } 

    public int getmTempMax() { 
     return mTempMax; 
    } 

    public void setmTempMax(int mTempMax) { 
     this.mTempMax = mTempMax; 
    }  
} 

、私たちは答えを見つけることを願って をありがとう!

* EDIT

ここMeteoJourクラスです:ここで

public class MeteoJour { 

    //private variables 
    int _id; 
    int _minimum; 
    int _maximum; 
    int _ressentie; 
    int _vent_vitesse; 
    String _vent_direction; 
    int _ensoleillement; 
    int _probabilite; 
    int _pluie; 
    int _neige; 


    // Empty constructor 
    public MeteoJour(){ 

    } 
    // constructor 
    public MeteoJour(int id, int minimum, int maximum, int ressentie, int vent_vitesse, String vent_direction, int ensoleillement, int probabilite, int pluie, int neige){ 
     this._id = id; 
     this._minimum = minimum; 
     this._maximum = maximum; 
     this._ressentie = ressentie; 
     this._vent_vitesse = vent_vitesse; 
     this._vent_direction = vent_direction; 
     this._ensoleillement = ensoleillement; 
     this._probabilite = probabilite; 
     this._pluie = pluie; 
     this._neige = neige; 
    } 

    // constructor 
    public MeteoJour(int minimum, int maximum, int ressentie, int vent_vitesse, String vent_direction, int ensoleillement, int probabilite, int pluie, int neige){ 
     this._minimum = minimum; 
     this._maximum = maximum; 
     this._ressentie = ressentie; 
     this._vent_vitesse = vent_vitesse; 
     this._vent_direction = vent_direction; 
     this._ensoleillement = ensoleillement; 
     this._probabilite = probabilite; 
     this._pluie = pluie; 
     this._neige = neige; 
    } 


    public int get_id() { 
     return _id; 
    } 

    public void set_id(int _id) { 
     this._id = _id; 
    } 

    public int get_minimum() { 
     return _minimum; 
    } 

    public void set_minimum(int _minimum) { 
     this._minimum = _minimum; 
    } 

    public int get_maximum() { 
     return _maximum; 
    } 

    public void set_maximum(int _maximum) { 
     this._maximum = _maximum; 
    } 

    public int get_ressentie() { 
     return _ressentie; 
    } 

    public void set_ressentie(int _ressentie) { 
     this._ressentie = _ressentie; 
    } 

    public int get_vent_vitesse() { 
     return _vent_vitesse; 
    } 

    public void set_vent_vitesse(int _vent_vitesse) { 
     this._vent_vitesse = _vent_vitesse; 
    } 

    public String get_vent_direction() { 
     return _vent_direction; 
    } 

    public void set_vent_direction(String _vent_direction) { 
     this._vent_direction = _vent_direction; 
    } 

    public int get_ensoleillement() { 
     return _ensoleillement; 
    } 

    public void set_ensoleillement(int _ensoleillement) { 
     this._ensoleillement = _ensoleillement; 
    } 

    public int get_probabilite() { 
     return _probabilite; 
    } 

    public void set_probabilite(int _probabilite) { 
     this._probabilite = _probabilite; 
    } 

    public int get_pluie() { 
     return _pluie; 
    } 

    public void set_pluie(int _pluie) { 
     this._pluie = _pluie; 
    } 

    public int get_neige() { 
     return _neige; 
    } 

    public void set_neige(int _neige) { 
     this._neige = _neige; 
    } 
} 

はR.array.villeのXMLです:

<string name="app_name">Lab5</string> 

<string-array name="joursSemaine"> 
    <item>Dimanche le 28 février 2016</item> 
    <item>Lundi le 29 février 2016</item> 
    <item>Mardi le 1 mars 2016</item> 
    <item>Mercredi le 2 mars 2016</item> 
    <item>Jeudi le 3 mars 2016</item> 
    <item>Vendredi le 4 mars 2016</item> 
    <item>Samedi le 5 mars 2016</item> 
</string-array> 

<string-array name="villes"> 
    <item>Gatineau</item> 
    <item>Trois-Rivière</item> 
    <item>Montreal</item> 
    <item>Sherbrooke</item> 
    <item>Alma</item> 
</string-array> 

マイログ:

04-27 08:21:24.986 2342-2342 /? I/art:後期対応 - Xcheck:jni 04-27 08:21:25.038 2342-2342 /? D /インサート::挿入。04-27 08:21:25.210 2342-2342 /? D/Reading ::すべてのmeteojoursを読む.. 04-27 08:21:25.211 2342-2342 /? D/Name :: Id:1、最小:2、最大:5 04-27 08:21:25.211 2342-2342 /? D/Name :: Id:2、最小:-1、最大:3 04-27 08:21:25.211 2342-2342 /? D/Name :: Id:3、Minimum:2、Maximum:6 04-27 08:21:25.211 2342-2342 /? D/Name :: Id:4、最小:3、最大:6 04-27 08:21:25.211 2342-2342 /? D/Name :: Id:5、Minimum:4、Maximum:5 04-27 08:21:25.211 2342-2342 /? D/Name :: Id:6、Minimum:4、Maximum:7 04-27 08:21:25.211 2342-2342 /? D/Name :: Id:7、Minimum:6、Maximum:8 04-27 08:21:25.211 2342-2342 /? D/Name :: Id:8、Minimum:4、Maximum:5 04-27 08:21:25.211 2342-2342 /? D/Name :: Id:9、Minimum:2、Maximum:5 04-27 08:21:25.211 2342-2342 /? D/Name :: Id:10、Minimum:2、Maximum:5 04-27 08:21:25.211 2342-2342 /? D/Name :: Id:11、Minimum:2、Maximum:5 04-27 08:21:25.211 2342-2342 /? D/Name :: Id:12、最小:6、最大:8 04-27 08:21:25.211 2342-2342 /? D/Name :: Id:13、Minimum:2、Maximum:5 04-27 08:21:25.211 2342-2342 /? D/Name :: Id:14、最小:6、最大:8 04-27 08:21:25.211 2342-2342 /? D/Name :: Id:15、Minimum:4、Maximum:5 04-27 08:21:25.211 2342-2342 /? D/Name :: Id:16、Minimum:2、Maximum:5 04-27 08:21:25.211 2342-2342 /? D/Name :: Id:17、Minimum:2、Maximum:5 04-27 08:21:25.211 2342-2342 /? D/Name :: Id:18、Minimum:4、Maximum:5 04-27 08:21:25.211 2342-2342 /? D/Name :: Id:19、Minimum:6、Maximum:8 04-27 08:21:25.211 2342-2342 /? D/Name :: Id:20、Minimum:2、Maximum:5 04-27 08:21:25.211 2342-2342 /? D/Name :: Id:21、最小:-1、最大:3 04-27 08:21:25.211 2342-2342 /? D/Name :: Id:22、最小:2、最大:5 04-27 08:21:25.211 2342-2342 /? D/Name :: Id:23、最小:2、最大:5 04-27 08:21:25.211 2342-2342 /? D/Name :: Id:24、最小:2、最大:5 04-27 08:21:25.211 2342-2342 /? D/Name :: Id:25、最小:2、最大:5 04-27 08:21:25.211 2342-2342 /? D/Name :: Id:26、Minimum:6、Maximum:8 04-27 08:21:25.211 2342-2342 /? D/Name :: ID:27、最小:2、最大:5 04-27 08:21:25.211 2342-2342 /? D/Name :: Id:28、Minimum:2、Maximum:5 04-27 08:21:25.211 2342-2342 /? D/Name :: Id:29、最小:2、最大:6 04-27 08:21:25.211 2342-2342 /?D/Name :: Id:30、最小:3、最大:6 04-27 08:21:25.211 2342-2342 /? D/Name :: Id:31、Minimum:2、Maximum:5 04-27 08:21:25.211 2342-2342 /? D/Name :: Id:32、Minimum:7、Maximum:10 04-27 08:21:25.211 2342-2342 /? D/Name :: Id:33、Minimum:2、Maximum:5 04-27 08:21:25.211 2342-2342 /? D/Name :: ID:34、最小:6、最大:8 04-27 08:21:25.211 2342-2342 /? D/Name :: Id:35、最小:2、最大:5 04-27 08:21:25.218 2342-2360 /? W/GooglePlayServicesUtil:Google Playサービスがありません。 04-27 08:21:25.254 2342-2361 /? D/OpenGLRenderer:EGL_SWAP_BEHAVIOR_PRESERVEDを使用:true 04-27 08:21:25.259 2342-2342 /? D/Atlas:地図の検証中... 04-27 08:21:25.271 2342-2342 /? W/ResourceType:リソース番号0x00000002の値を取得するときのパッケージ識別子なし04-27 08:21:25.272 2342-2342 /? D/AndroidRuntime:VMをシャットダウン04-27 08:21:25.291 2342-2342 /? E/AndroidRuntime:致命的な例外:メインプロセス:com.example.android.lab5、PID:2342 android.content.res.Resources $ NotFoundException:android.content.res.Resources.getTextのStringリソースID#0x2(Resources.java :299)android.widget.TextView.setText(TextView.java:4132)com.example.android.lab5.JourAdapteur.getView(JourAdapteur.java:41)android.widget.AbsListView.obtainView(AbsListView.java: 2347)android.widget.ListView.measureHeightOfChildren(ListView.java:1270)android.widget.ListView.onMeasure(ListView.java:1182)android.view.View.measure(View.java:17547)in android。 android.view.View.View.View.View.View.MarketingChildWithMarginsのandroid.view.View.measure(View.java:17547)のandroid.widget.RelativeLayout.onMeasure(RelativeLayout.java:481)のウィジェット.RelativeLayout.measureChild(RelativeLayout.java:697) (ViewGroup.java:5535)android.widget.FrameLayout.onMeasure(FrameLayout.java:436)android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:135)android.vでandroid.support.v7.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:391)android.viewのandroid.view.View.View.View.View.MoveviewChildWithMargins(ViewGroup.java:5535)のView.measureビュー(View.java:17547) android.view.View.MeasureChildWithMargins(ViewGroup.java:5535)の.View.measure(View.java:17547)をandroid.view.View.measureのandroid.widget.FrameLayout.onMeasure(FrameLayout.java:436) View.java:17547)android.window.LinearLayout.measureVertical(LinearLayout.java:722)のandroid.view.View.View.View.MeasureChildWithMargins(ViewGroup.java:5535)とandroid.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1436)です。 )android.view.View.View.MeasureChildWithMargins(ViewGroup.java:5535)at android.widget(android.widget.LinearLayout.onMeasure(LinearLayout.java:613)のandroid.view.View.Measure(View.java:17547)のandroid.widget.LinearLayout.onMeasure .FrameLayout.onMeasure(FrameLayout.java:436)at com.android.internal.policy.impl.PhoneWindow $ DecorView.onMeasure(PhoneWindow.java:2615)android.view.View .roid.view.View.ViewRootImpl.performMeasure(ViewRootImpl.java:2015)のandroid.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1173)の.measure(View.java:17547)をandroid.view.ViewRootImpl.performTraversals(ViewRootImpl。 inroid.view.View.RootImpl.java:1061)のandroid.view.ViewRootImpl $ TraversalRunnable.run(ViewRootImpl.java:5885)android.view.Choreographer $ CallbackRecord.run(Choreographer.java :767)android.view.Choreographer.doCallbacks(Choreographer.java:580)android.view.Choreographer.doFrame(Choreographer.java:550)android.view.Choreographer $ FrameDisplayEventReceiver.run(Choreographer.java:753) android.os.Handler.handleCallback(Handler.java:739)android.os.Handler.dispatchMessage(Handler.java:95)android.os.Looper.loop(Looper.java:135)android.appにあります。 com.android.internalのjava.lang.reflect.Method.invoke(ネイティブメソッド)java.lang.reflect.Method.invoke(Method.java:372)のActivityThread.main(ActivityThread.java:5254)。 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)のos.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:903)04-27 08:21:28.734 2342-2342/com.example.android .lab5 I/Process:シグナルを送信します。 PID:2342 SIG:9

JourAdapteurクラス:

パブリッククラスJourAdapteurあなたはリソースIDを期待setText(int)を呼んでいるArrayAdapter {

private Context mContext; 
private LayoutInflater mInflater; 

public JourAdapteur(Context context, ArrayList<Jour> jours) { 
    super(context, 0, jours); 
    mContext = context; 
    mInflater = LayoutInflater.from(context); 
} 

@Override 
public View getView(int position, View convertView, ViewGroup parent) { 
    View theView = convertView; 

    if (theView == null) { 
     theView = mInflater.inflate(R.layout.jour_list_item, parent, false); 
    } 

    // Le hero 
    Jour jour = this.getItem(position); 

    // Aller chercher les objets 
    TextView lblMin = (TextView) theView.findViewById(R.id.lblMin); 
    TextView lblMax = (TextView) theView.findViewById(R.id.lblMax); 
    TextView lblDate = (TextView) theView.findViewById(R.id.lblDate); 

    // Assigner les valeurs 
    lblMin.setText(jour.getmTempMin()); 
    lblMax.setText(jour.getmTempMax()); 
    lblDate.setText(jour.getmDates()); 


    // Retourner la vue 
    return theView; 
} 

@Override 
public View getDropDownView(int position, View convertView, ViewGroup parent) { 
    // TODO Auto-generated method stub 
    return getView(position, convertView, parent); 
} 

}

+0

問題は、リソースIDとない整数リテラル値を期待し 'のsetText(int)を呼び出している' 'JourAdapteur.getView(JourAdapteur.java:41)'です。 – laalto

+0

@laalto JourAdapteurクラスを追加しました。 java:41 - > lblMin.setText(jour.getmTempMin()); – Ismael

答えて

1
lblMin.setText(jour.getmTempMin()); 
lblMax.setText(jour.getmTempMax()); 

を拡張します。代わりにsetText(CharSequence)を使用するには、コードを次のように変更します。

lblMin.setText(String.valueOf(jour.getmTempMin())); 
lblMax.setText(String.valueOf(jour.getmTempMax())); 
関連する問題