0

I have an android application with Google Maps widged built in. I linked the widget conditionally, that is the code loading the widget looks like this:

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

    try
    {
      Class.forName("com.google.android.maps.MapView");

      Intent i = new Intent();
      i.setClass(this, GoogleMapsActivity.class);

      startActivity(i);
      finish();
    }
    catch(ClassNotFoundException e)
    {
      TextView tv = (TextView)findViewById(R.id.google_maps_start);
      tv.setText(R.string.not_found);
    }
  }
}

and AndroidManifest contains the line:

<uses-library android:name="com.google.android.maps" android:required="false" />

The widget works normally in the emulator and in real devices, but there is also a device, where I see "Google Maps not found" message, initiated by ClassNotFoundException handler. Nevertheless, the same device does have Google Maps on board and they work ok. So the question is what is wrong with my application, or possibly with the specific device, and how to fix the problem?

Stan
  • 8,683
  • 9
  • 58
  • 102
  • Which device? Do you have a logcat for the error? – Bo. Jun 07 '12 at 12:43
  • The device is chines Teclast tPAD. There is no error. Apparently, class com.google.android.maps.MapView is not found, and this situation is handled by the application by design, as you can see in the code. – Stan Jun 07 '12 at 12:52
  • Did you try to lunch intent as suggested here: http://stackoverflow.com/a/2663565/200272 – Bo. Jun 07 '12 at 13:44
  • @Bo. I didn't, I could do this for testing only, because this approach is not allowing much customization, which I use for the map. Also, I'm not sure this is helpful at all in my case, because the invocation of external intent works around the classes, so to speak, and should work as far as I can launch Google Maps on their own on this device. – Stan Jun 07 '12 at 13:56

0 Answers0