mirror of
https://github.com/bspeice/itcs4180
synced 2024-12-04 21:28:10 -05:00
Fixed contexts.
This commit is contained in:
parent
a9e13e3826
commit
c4a3799243
@ -60,7 +60,7 @@ public class CompassActivity extends Activity implements SensorEventListener
|
||||
compassRoseView = (ImageView)findViewById(R.id.compassRoseView);
|
||||
searchImageView = (ImageView)findViewById(R.id.searchImageView);
|
||||
searchImageView.setVisibility(View.INVISIBLE);
|
||||
Bitmap b = BitmapAccess.loadBitmap(getApplicationContext(), restLocation.getName());
|
||||
Bitmap b = BitmapAccess.loadBitmap(this, restLocation.getName());
|
||||
if(b != null)
|
||||
{
|
||||
searchImageView.setImageBitmap(b);
|
||||
@ -94,7 +94,7 @@ public class CompassActivity extends Activity implements SensorEventListener
|
||||
}
|
||||
});
|
||||
|
||||
Toast.makeText(getApplicationContext(), ""+searchLocation.getLatitude()+", "+searchLocation.getLongitude(), Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(this, ""+searchLocation.getLatitude()+", "+searchLocation.getLongitude(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -46,7 +46,7 @@ public class FoundActivity extends Activity {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
intent = new Intent(getApplicationContext(), MainActivity.class);
|
||||
intent = new Intent(FoundActivity.this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ public class MainActivity extends Activity {
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view,int position, long id) {
|
||||
Intent intent = new Intent(getApplicationContext(), SearchActivity.class);
|
||||
Intent intent = new Intent(MainActivity.this, SearchActivity.class);
|
||||
intent.putExtra("restLocation", locations.get(position));
|
||||
startActivity(intent);
|
||||
}
|
||||
@ -94,6 +94,7 @@ public class MainActivity extends Activity {
|
||||
|
||||
// And we're even kind enough to update the database
|
||||
LocationDatabaseHelper.getInstance(MainActivity.this).persistAll(result);
|
||||
locations = LocationDatabaseHelper.getInstance(getBaseContext()).fetchAll();
|
||||
}
|
||||
}.execute();
|
||||
|
||||
|
@ -101,7 +101,7 @@ public class SearchActivity extends Activity {
|
||||
|
||||
if(lm.isProviderEnabled(LocationManager.GPS_PROVIDER))
|
||||
{
|
||||
intent = new Intent(getApplicationContext(), CompassActivity.class);
|
||||
intent = new Intent(SearchActivity.this, CompassActivity.class);
|
||||
intent.putExtra("restLocation", restLocation);
|
||||
startActivity(intent);
|
||||
}
|
||||
@ -131,7 +131,7 @@ public class SearchActivity extends Activity {
|
||||
});
|
||||
|
||||
Toast.makeText(getApplicationContext(), restLocation.getRiddleImageUrl(), Toast.LENGTH_SHORT).show();
|
||||
Bitmap locationPicture = BitmapAccess.loadBitmap(getApplicationContext(), restLocation.getName());
|
||||
Bitmap locationPicture = BitmapAccess.loadBitmap(this, restLocation.getName());
|
||||
if(locationPicture != null)
|
||||
{
|
||||
locationImage.setImageBitmap(locationPicture);
|
||||
@ -171,18 +171,18 @@ public class SearchActivity extends Activity {
|
||||
String contents = data.getStringExtra("SCAN_RESULT");
|
||||
if(contents.equals(restLocation.getName()))
|
||||
{
|
||||
intent = new Intent(getApplicationContext(), FoundActivity.class);
|
||||
intent = new Intent(SearchActivity.this, FoundActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
else
|
||||
{
|
||||
Toast.makeText(getApplicationContext(), "Incorrect place found: "+contents, Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(SearchActivity.this, "Incorrect place found: "+contents, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
else if (resultCode == RESULT_CANCELED)
|
||||
{
|
||||
Toast.makeText(getApplicationContext(), "Error scanning code", Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(SearchActivity.this, "Error scanning code", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -209,7 +209,7 @@ public class SearchActivity extends Activity {
|
||||
if(result!=null)
|
||||
{
|
||||
locationImage.setImageBitmap(result);
|
||||
BitmapAccess.saveBitmap(getApplicationContext(), result, restLocation.getName());
|
||||
BitmapAccess.saveBitmap(SearchActivity.this, result, restLocation.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user