I dont understand why this code dont work the for int error. I tried using the following code:
package com.example.android.touregiude;
import android.content.res.TypedArray;
import android.location.Location;
import com.example.android.cairotourguide.R;
public class hotelsFragment extends CategoryAbstractFragment {
/**
* Constructor
*/
public hotelsFragment() {
// Required empty public constructor
}
/**
* Overridden methods
*/
@Override
void populateLocationsList() {
String[] LocationsNames = getResources().getStringArray(R.array.Hotels_names);
String[] LocationsAddresses = getResources().getStringArray(R.array.Hotels_addresses);
String[] LocationsPhoneNumbers = getResources().getStringArray(R.array.Hotels_phone_numbers);
TypedArray LocationsImagesResIds = getResources().obtainTypedArray(R.array.Hotels_images);
for (int i = 0; i < LocationsNames.length; ++i) {
locationsList.add(new Location (LocationsNames[i],
LocationsAddresses[i],
getString(R.string.Location_open_24_hours),
LocationsPhoneNumbers[i],
getString(R.string.Location_wiki_url_not_provided_text),
LocationsImagesResIds.getResourceId(i,0)));
}
LocationsImagesResIds.recycle();
}
}
The encountered error:
error: no suitable constructor found for
Location(String,String,String,String,String,int) constructor
Location.Location(String) is not applicable (actual and formal
argument lists differ in length) constructor
Location.Location(Location) is not applicable (actual and formal argument lists differ in length)