Handle tap on MyLocationOverlay current GPS position

by Stu » Sun, 09 Nov 2008 17:15:03 GMT


Sponsored Links
 Hi there.

I'm having trouble handling a tap on my current location in a
MyLocationOverlay. There seem to be functions specifically for this,
but I can't seem to handle it correctly.

My class look like this:

public class MyApp extends MapActivity implements LocationListener {

and when I try to override the dispatchTap() method I get told that it
must override a superclass. I'm assuming it's something to do with the
fact that my class has no link with MyLocationOverlay. I tried adding
it to the list of implements, but MyLocationOverlay is appanrently not
an interface, or something.

Can anyone tell me how I should go about handling a click on the
current location using a MyLocationOverlay, or not using one if it has
to be done a different way?

Thanks and regards,
Stuart.

--~--~---------~--~----~------------~-------~--~----~



Handle tap on MyLocationOverlay current GPS position

by Guillaume Perrot » Mon, 10 Nov 2008 18:31:50 GMT


 Create a MyLocationOverlay subclass, and override dispatchTap().



--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Other Threads

1. Camera Activity and screen rotation

Hello

I'm using this code to start a Camera activity and retrieve image

ContentValues values = new ContentValues();
values.put(Media.TITLE, "app" +
String.valueOf(System.currentTimeMillis()));
values.put(Media.DESCRIPTION, "Image ...");
Uri uri =
getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
values);

cameraIntent     = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
startActivityForResult(cameraIntent, PICTURE_RESULT);

and then in onActivityResult I retrieve Uri with

Uri uri = (Uri)cameraIntent.getExtras().get(MediaStore.EXTRA_OUTPUT);

The code works only if I dont change screen rotation :) If a parent
activity is in Portrait and in camera activity I rotate my phone (to
Landscape) then in onActivityResult I dont get uri. But if I dont
rotate phone in camera activity, then everything works. Same error is
for Landscape -> Portrait..

Any ideas what could be wrong? I'm developing on 1.5...

-- 

2. startService an unusual way results in a a NullPointerException

Hi everyone!

I am trying to start a service an unusual way. The reason for this is
to keep at least some parts of the program platform independent. The
startService() function is called from the Service class itself and
there
I get a NullPointerException.

I made a small example to show the problem (see below). Any ideas?
Thanks!


/* HelloAndroid.java */
package com.example.helloandroid;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;

package com.example.helloandroid;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;

public class HelloAndroid extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        // start buttons
        findViewById(R.id.start).setOnClickListener(new
OnClickListener() {
            public void onClick(View v) {
                startService(new
Intent("com.example.helloandroid.UnusualService"));
            }
        });
        // stop buttons
        findViewById(R.id.stop).setOnClickListener(new
OnClickListener() {
            public void onClick(View v) {
                stopService(new
Intent("com.example.helloandroid.UnusualService"));
            }
        });
        // unusual start
        findViewById(R.id.unusual).setOnClickListener(new
OnClickListener() {
            public void onClick(View v) {
                UnusualService myService = new UnusualService();
                myService.startService();
            }
        });
    }
}

/* UnusualService */
package com.example.helloandroid;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;

public class UnusualService extends Service {
        @Override
        public IBinder onBind(Intent intent) {
                return null;    // TODO make something
        }

        public void startService() {
                // the folowing line will throw the exception
                startService(new 
Intent("com.example.helloandroid.UnusualService"));
        }

        public void stopService() {
                stopSelf();
        }
}

-- 

3. Select behavior of a TextView

4. can't get module

5. Button organisation

6. error: 'dynamic_cast' not permitted with -fno-rtti

7. all processes/services in init.rc exiting . Android does not start