我的logcat中的错误是这样的
logcat的
08-29 08:20:57.961: ERROR/AndroidRuntime(1766): java.lang.RuntimeException: Unable to start activity ComponentInfo{one.two/one.two.Booking}: java.lang.IllegalArgumentException: column '_id' does not exist
08-29 08:20:57.961: ERROR/AndroidRuntime(1766): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2268)
08-29 08:20:57.961: ERROR/AndroidRuntime(1766): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2284)
08-29 08:20:57.961: ERROR/AndroidRuntime(1766): at android.app.ActivityThread.access$1800(ActivityThread.java:112)
08-29 08:20:57.961: ERROR/AndroidRuntime(1766): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
08-29 08:20:57.961: ERROR/AndroidRuntime(1766): at android.os.Handler.dispatchMessage(Handler.java:99)
08-29 08:20:57.961: ERROR/AndroidRuntime(1766): at android.os.Looper.loop(Looper.java:123)
08-29 08:20:57.961: ERROR/AndroidRuntime(1766): at android.app.ActivityThread.main(ActivityThread.java:3948)
08-29 08:20:57.961: ERROR/AndroidRuntime(1766): at java.lang.reflect.Method.invokeNative(Native Method)
08-29 08:20:57.961: ERROR/AndroidRuntime(1766): at java.lang.reflect.Method.invoke(Method.java:521)
08-29 08:20:57.961: ERROR/AndroidRuntime(1766): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
08-29 08:20:57.961: ERROR/AndroidRuntime(1766): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
08-29 08:20:57.961: ERROR/AndroidRuntime(1766): at dalvik.system.NativeStart.main(Native Method)
08-29 …Run Code Online (Sandbox Code Playgroud) 嗨,我想让我的地图放大到我当前的位置.当前通过向仿真器发送lat和long来定义当前位置.我该怎么做呢?
我目前的mapactivity.java
public class MapsActivity extends MapActivity {
private MapView mapView;
private MyLocationOverlay myLocOverlay;
MapController mc;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mapactivity);
initMap();
initMyLocation();
}
/**
* Initialise the map and adds the zoomcontrols to the LinearLayout.
*/
private void initMap() {
mapView = (MapView) findViewById(R.id.mapView);
View zoomView = mapView.getZoomControls();
LinearLayout myzoom = (LinearLayout) findViewById(R.id.zoom);
myzoom.addView(zoomView);
mapView.displayZoomControls(true);
mapView.getController().setZoom(17);
}
/**
* Initialises the MyLocationOverlay and adds it to the …Run Code Online (Sandbox Code Playgroud) 我想用谷歌地图显示我在Android手机上的当前位置.以下代码是否能够在谷歌地图上显示我当前的位置?
MapsActivity.java
package log1.log2;
import log1.log2.MyLocation.LocationResult;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.MapView.LayoutParams;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationManager;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
public class MapsActivity extends MapActivity
{
MapView mapView;
MapController mc;
GeoPoint p;
/** Called when the activity is first created. */
@SuppressWarnings("deprecation")
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.mapactivity);
mapView = (MapView) findViewById(R.id.mapView);
LinearLayout zoomLayout = (LinearLayout)findViewById(R.id.zoom);
View zoomView = mapView.getZoomControls();
zoomLayout.addView(zoomView,
new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT));
mapView.displayZoomControls(true);
}
MyLocation myLocation = …Run Code Online (Sandbox Code Playgroud) logcat的
08-17 06:37:22.264: ERROR/AndroidRuntime(1090): java.lang.RuntimeException: Unable to start activity ComponentInfo{one.two/one.two.Booking}: java.lang.NullPointerException
08-17 06:37:22.264: ERROR/AndroidRuntime(1090): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2268)
08-17 06:37:22.264: ERROR/AndroidRuntime(1090): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2284)
08-17 06:37:22.264: ERROR/AndroidRuntime(1090): at android.app.ActivityThread.access$1800(ActivityThread.java:112)
08-17 06:37:22.264: ERROR/AndroidRuntime(1090): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
08-17 06:37:22.264: ERROR/AndroidRuntime(1090): at android.os.Handler.dispatchMessage(Handler.java:99)
08-17 06:37:22.264: ERROR/AndroidRuntime(1090): at android.os.Looper.loop(Looper.java:123)
08-17 06:37:22.264: ERROR/AndroidRuntime(1090): at android.app.ActivityThread.main(ActivityThread.java:3948)
08-17 06:37:22.264: ERROR/AndroidRuntime(1090): at java.lang.reflect.Method.invokeNative(Native Method)
08-17 06:37:22.264: ERROR/AndroidRuntime(1090): at java.lang.reflect.Method.invoke(Method.java:521)
08-17 06:37:22.264: ERROR/AndroidRuntime(1090): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
08-17 06:37:22.264: ERROR/AndroidRuntime(1090): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
08-17 06:37:22.264: ERROR/AndroidRuntime(1090): at dalvik.system.NativeStart.main(Native Method)
08-17 06:37:22.264: ERROR/AndroidRuntime(1090): Caused by: java.lang.NullPointerException
08-17 …Run Code Online (Sandbox Code Playgroud) 有什么办法可以为我的计时器添加毫秒数吗?
我目前正在使用这个计时器,但它只能在几秒钟内完成.
var count=99;
var counter=setInterval(timer, 1000); //1000 will run it every 1 second
function timer(){
count=count-1;
if (count <= 0){
clearInterval(counter);
return;
}
document.getElementById("timer").innerHTML=count + " seconds"; // watch for spelling
}
Run Code Online (Sandbox Code Playgroud)
谢谢