Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Android
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Android
java.lang.Integer error
Naishadh Parmar
Ranch Hand
Posts: 95
I like...
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hey guys,
I get this error:
"Class File Editor
Source not found
The source attachment does not contain the source for the file Integer.class.
You can change the source attachment by clicking Change Attached Source Below:
(Button)Change attached Source ....."
for this code:
package org.gps.main; import android.app.Activity; import android.content.*; import android.graphics.*; import android.graphics.drawable.*; import android.location.*; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.ImageView; import android.widget.SeekBar; public class MapActivity extends Activity implements LocationListener{ Bitmap b = null; BitmapDrawable d = null; Canvas c = null; int diffLon = 68; int diffLat = 37; int prevProg = 0; ImageView im = null; LocationManager lm = null; LocationProvider lp = null; Location l = null; Paint paint = null; SeekBar sb = null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); im = (ImageView) findViewById(R.id.map1); im.invalidate(); sb = (SeekBar) findViewById(R.id.seekBar1); d = (BitmapDrawable) im.getDrawable(); b = d.getBitmap(); paint = new Paint(); paint.setColor(Color.GREEN); init(); } public void init() { lm = (LocationManager) getApplicationContext().getSystemService(Context.LOCATION_SERVICE); lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 6000, 1000, this); sb.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if(sb.getProgress() != prevProg) { } } }); } @Override public void onLocationChanged(Location location) { int lon = Integer.valueOf(String.valueOf(location.getLongitude())); int fLon = lon - diffLon; int lat = Integer.valueOf(String.valueOf(location.getLatitude())); int fLat = lat - diffLat; int color = b.getPixel(fLon, fLat); b.setPixel(fLon, fLat, Color.GREEN); im.setImageBitmap(b); } @Override public void onProviderDisabled(String provider) { // TODO Auto-generated method stub } @Override public void onProviderEnabled(String provider) { // TODO Auto-generated method stub } @Override public void onStatusChanged(String provider, int status, Bundle extras) { // TODO Auto-generated method stub } }
In Eclipse
IDE
.
Please help
Chrobione Robinson
Greenhorn
Posts: 7
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
public void onLocationChanged(Location location) { int lon = Integer.valueOf(String.valueOf(location.getLongitude())); int fLon = lon - diffLon; int lat = Integer.valueOf(String.valueOf(location.getLatitude())); int fLat = lat - diffLat; int color = b.getPixel(fLon, fLat); b.setPixel(fLon, fLat, Color.GREEN); im.setImageBitmap(b); }
This is where your issue is....location.getLongitude() returns a double.
Instead of figuring out how to get the double to a int the better question what are you trying to feed that needs an int value?
Naishadh Parmar
Ranch Hand
Posts: 95
I like...
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
the b.setPixel() method needs two ints, one X and other y
If you were a tree, what sort of tree would you be? This tiny ad is a poop beast.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
it doesn't give me the country name
it doesn't shows location details
it doesn't change the longitude & latitude
how to add a google search option
how to use distanceBetween built in methog
More...