MapActivity, Buttons and OnClickListener

by nmesisca » Tue, 21 Apr 2009 23:10:17 GMT


Sponsored Links
 Hi all,
could you give me some help please? I have written a simple
MapActivity that contains a mapview (defined in the xml file); it also
contains a Button.
If the Button has no OnClickListener associated then the project runs
fine (the mapview is of course empty).
If I add an OnclickListener the application simply Force closes.
Has anyone tried this? I was actually following the example in a book
but I guess something has changed in the SDK since it was written?
I did also remember to add the permissions (INTERNET, COARSE LOC and
FINE LOC) and the uses-library too as per documentation.
I m using SDK 1.1 (for the moment).
If you have (recently) written something similar, could you give me
some pointers please?
Here is my java class:

package com.chipset.testgps;

import com.google.android.maps.MapView;
import android.widget.Button;
import com.google.android.maps.MapActivity;
import android.os.Bundle;

public class main extends MapActivity {
@Override
public boolean isRouteDisplayed(){
return false;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final Button but = (Button) findViewById(R.id.gpsButton);

// but.setOnClickListener(new View.OnClickListener() {
// public void onClick(View v){
//
// }
// });

final MapView map = (MapView) findViewById(R.id.myMap);
setContentView(R.layout.main);
}
}





thanks
N

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



MapActivity, Buttons and OnClickListener

by nmesi...@gmail.com » Tue, 21 Apr 2009 23:12:13 GMT


 Hi all,
could you give me some help please? I have written a simple
MapActivity that contains a mapview (defined in the xml file); it also
contains a Button.
If the Button has no OnClickListener associated then the project runs
fine (the mapview is of course empty).
If I add an OnclickListener the application simply Force closes.
Has anyone tried this? I was actually following the example in a book
but I guess something has changed in the SDK since it was written?
I did also remember to add the permissions (INTERNET, COARSE LOC and
FINE LOC) and the uses-library too as per documentation.
I m using SDK 1.1 (for the moment).
If you have (recently) written something similar, could you give me
some pointers please?
Here is my java class:

package com.chipset.testgps;

import com.google.android.maps.MapView;
import android.widget.Button;
import com.google.android.maps.MapActivity;
import android.os.Bundle;

public class main extends MapActivity {
@Override
public boolean isRouteDisplayed(){
return false;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final Button but = (Button) findViewById(R.id.gpsButton);

// but.setOnClickListener(new View.OnClickListener() {
// public void onClick(View v){
//
// }
// });

final MapView map = (MapView) findViewById(R.id.myMap);
setContentView(R.layout.main);
}
}





thanks
N

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


Sponsored Links


MapActivity, Buttons and OnClickListener

by kostmo » Tue, 26 May 2009 07:15:15 GMT


 Found the answer here:
 http://www.anddev.org/help_me_with_my_first_map_application-t5674.html 

You need to add
<uses-library android:name="com.google.android.maps"/>
as a child of the the <application> element.

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



Other Threads

1. How can i run monkey on pre-defined activities

Hi,
         I need to test some sequence of activities of my application.
so i selected
monkey tool which generate the random hits and touch on an selected package.
Please help to do monkey testing on an pre-defined activities.

Thanks in Advance
-- Madhu


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

2. No space left on device

Hi
    I develop meet this problem ,there is No space left on device.How do we
handle this error.



                                                       thanks

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

3. How to PORTING Android to Dopod or other mobile phone

4. Sync Microsoft Outlook Email!

5. Send Http Request

6. about Android filesysm Architecture.

7. Is there a command in the API to turn the keyboard backlight off?