开发者

Android: No class definition found error

this is a screen with two buttons to show satellite view and street view of maps. the modules of streetview and SatelliteView work perfectly fine separately. but when included in a single app with two buttons(intent) it shows the following errors. please help

10-16 16:33:20.400: ERROR/AndroidRuntime(15483): FATAL EXCEPTION: main
10-16 16:33:20.400: ERROR/AndroidRuntime(15483): java.lang.NoClassDefFoundError: com.uhcl.maps.StreetView
10-16 16:33:20.400: ERROR/AndroidRuntime(15483):     at com.uhcl.maps.MymenuActivity.onClick(MymenuActivity.java:39)
10-16 16:33:20.400: ERROR/AndroidRuntime(15483):     at android.view.View$PerformClick.run(View.java:11928)
10-16 16:33:20.400: ERROR/AndroidRuntime(15483):     at android.os.Handler.handleCallback(Handler.java:587)
10-16 16:33:20.400: ERROR/AndroidRuntime(15483):     at android.os.Handler.dispatchMessage(Handler.java:92)
10-16 16:33:20.400: ERROR/AndroidRuntime(15483):     at android.os.Looper.loop(Looper.java:132)
10-16 16:33:20.400: ERROR/AndroidRuntime(15483):     at android.app.ActivityThread.main(ActivityThread.java:4025)
10-16 16:33:20.400: ERROR/AndroidRuntime(15483):     at java.lang.reflect.Method.invokeNative(Native Method)
10-16 16:33:20.400: ERROR/AndroidRuntime(15483):     at java.lang.reflect.Method.invoke(Method.java:491)
10-16 16:33:20.400: ERROR/AndroidRuntime(15483):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
10-16 16:33:20.400: ERROR/AndroidRuntime(15483):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
10-16 16:33:20.400: WARN/ActivityManager(130):   Force finishing activity com.uhcl.maps/.MymenuActivity

this is my Activity class

package com.uhcl.maps;`
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class MymenuActivity extends Activity implements OnClickListener {
/** Called when the activity is first created. */
Button satelliteviwb1, streetviewb2, floormapb3;
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.menu);

    satelliteviwb1 = (Button) findViewById(R.id.b1);
    streetviewb2 = (Button) findViewById(R.id.b2);
    floormapb3 = (Button) findViewById(R.id.flooricon);
    satelliteviwb1.setOnClickListener(this);
    streetviewb2.setOnClickListener(this);
    floormapb3.setOnClickListener(this);

}

@Override
public void onClick(View v) {
    // TODO Auto-generated method stub

    switch (v.getId()) {


    case R.id.b1:
        Intent intent = new Intent(MymenuActivity.this, SatelliteView.class);
        // Intent intent = new Intent("com.uhcl.maps.SATELLITEVIEW");
        MymenuActivity.this.startActivity(intent);
    case R.id.b2:
        Intent intent2 = new Intent(MymenuActivity.this, StreetView.class);
        // Intent intent2 = new Intent("com.uhcl.maps.STREETVIEW");
        MymenuActivity.this.startActivity(intent2);

    case R.id.flooricon:
        Intent intent3 = new Intent(MymenuActivity.this, FloorView.class);
        // Intent intent2 = new Intent("com.uhcl.maps.STREETVIEW");
        MymenuActivity.this.startActivity(intent3);

    }


    }
}

and this is my map activity

package com.uhcl.maps;    
import java.util.List;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
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.MyLocationOverlay;
import com.google.android.maps.Overlay;
import com.google.android.maps.OverlayItem;

public class SatelliteView extends MapActivity {

public MapView mapView;
public CustomItemizedOverlay itemizedOverlay;
public Drawable drawable;
public List<Overlay> mapOverlays;


public MyLocationOverlay compass;

@Override
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    mapView = (MapView) findViewById(R.id.mapview);
    mapView.setBuiltInZoomControls(true);

    mapOverlays = mapView.getOverlays();

     drawable = this.getResources().getDrawable(R.drawable.icon);

 itemizedOverlay = new CustomItemizedOverlay(
            drawable, this);

    //Latitude and Longitude 
    Float sscbla = 29.5843F;
    Float sscblo = -95.098983F;
    Float deltala = 29.577683F;
    Float deltalo = -95.104208F;
    Float csbla = 29.585831F;
    Float csblo = -95.094133F;
    Float arbourla = 29.577933F;
    Float arbourlo = -95.102219F;
    //Float bayoula= F;
    //Float bayoulo= F;

    GeoPoint point = new GeoPoint((int) (deltala * 1E6),
            (int) (deltalo * 1E6));
    OverlayItem overlayitem = new OverlayItem(point, "Hello",
            "I'm at Uhcl, Delta building!");

    GeoPoint point2 = new GeoPoint((int) (sscbla * 1E6),
            (int) (sscblo * 1E6));
    OverlayItem overlayitem2 = new OverlayItem(point2, "Hello",
            "I'm at Uhcl, Student Services building!");

    GeoPoint point3 = new GeoPoint((int) (csbla * 1E6),
            (int) (csblo * 1E6));
    OverlayItem overlayitem3 = new OverlayItem(point3, "Hello",
            "I'm at Uhcl, Central Services building!");

    GeoPoint point4 = new GeoPoint((int) (arbourla * 1E6),
            (int) (arbourlo * 1E6));
    OverlayItem overlayitem4 = new OverlayItem(po开发者_如何转开发int4, "Hello",
            "I'm at Uhcl, Arbour building!");


    /*GeoPoint point5 = new GeoPoint((int) (bayoula * 1E6),
            (int) (bayoulo * 1E6));
    OverlayItem overlayitem4 = new OverlayItem(point5, "Hello",
            "I'm at Uhcl, Bayou building!");*/


    itemizedOverlay.addOverlay(overlayitem);
    itemizedOverlay.addOverlay(overlayitem2);
    itemizedOverlay.addOverlay(overlayitem3);
    itemizedOverlay.addOverlay(overlayitem4);
    //itemizedOverlay.addOverlay(overlayitem5);

    mapOverlays.add(itemizedOverlay);

    mapView.setSatellite(true);
    MapController mapController = mapView.getController();

    mapController.animateTo(point2);
    mapController.setZoom(17);

    compass = new MyLocationOverlay(this, mapView);
    mapView.getOverlays().add(compass);

}

@Override
protected void onPause() {
    // TODO Auto-generated method stub
    super.onPause();
    compass.disableCompass();
}

@Override
protected void onResume() {
    // TODO Auto-generated method stub
    super.onResume();
    compass.enableCompass();
}

@Override
protected boolean isRouteDisplayed() {
    return false;
}

}


java.lang.NoClassDefFoundError: com.uhcl.maps.StreetView

usually means that the class in question isn't in the CLASSPATH. The class loader can't find it.

Is this a homework question? Should you have a JAR from this site in your project somewhere?

http://prtl.uhcl.edu/portal/page/portal/HOMEPAGE/MAPS_DIRECTIONS/CampusMap

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜