我在下面放置一個代碼,我創建了一個本地線程,並在最後一個關閉大括號中出現錯誤,任何人都可以爲我整理它。需要找到線程錯誤
Thread dt = new Thread(this){
public void run()
{
Looper.prepare();
GetCurrentLocation loc = new GetCurrentLocation(RestaurantFinder.this);
loc.setLocParams();
int counter = 0;
String lat = GetCurrentLocation.getCurrentLatitude();
String lon = GetCurrentLocation.getCurrentLongitude();
while (lat == null && lon == null
&& counter <= 1000)
{
lat = GetCurrentLocation.getCurrentLatitude();
lon = GetCurrentLocation.getCurrentLongitude();
counter = counter + 1;
}
System.out.println("The Latitude are:" + lat);
System.out.println("The Longitude are:"+ lon);
if (lat == null && lon == null)
{
// another alert for location not found
AlertDialog.Builder builder1 = new AlertDialog.Builder(RestaurantFinder.this);
builder1.setTitle("Restaurant Finder");
builder1.setMessage("Unable to find the Current Location");
builder1.setPositiveButton("OK",new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog,int which)
{
dialog.dismiss();
}
});
AlertDialog dialog1 = builder1.create();
dialog1.show();
// dismiss ProgressDialog by Handler
pd.dismiss();
}
else
{
weather();
// dismiss ProgressDialog by Handler
pd.dismiss();
}
}
});<--(Error:Syntax error on token ")", Delete this token)
太謝謝你了斯蒂芬C,我整理出來,參照你的答案。就是那個讓我陷入泥潭的「這個」。現在完全正確。 – 2010-09-08 05:36:14