android - ActivityNotFoundException (MapActivity) -
i have mapactivity in application. included @ manifest file when run application , runs fine except mapactivity, whenever try start mapactivity clicking button gives following errors,
07-02 18:06:39.752: error/androidruntime(354): fatal exception: main 07-02 18:06:39.752: error/androidruntime(354): android.content.activitynotfoundexception: unable find explicit activity class {com.xtreme.isenegal/java.util.map}; have declared activity in androidmanifest.xml? 07-02 18:06:39.752: error/androidruntime(354): @ android.app.instrumentation.checkstartactivityresult(instrumentation.java:1404) 07-02 18:06:39.752: error/androidruntime(354): @ android.app.activitythread.resolveactivityinfo(activitythread.java:2473) 07-02 18:06:39.752: error/androidruntime(354): @ android.app.localactivitymanager.startactivity(localactivitymanager.java:277) 07-02 18:06:39.752: error/androidruntime(354): @ com.xtreme.isenegal.activity1.replacecontentview(activity1.java:28) 07-02 18:06:39.752: error/androidruntime(354): @ com.xtreme.isenegal.details$2.onclick(details.java:94) 07-02 18:06:39.752: error/androidruntime(354): @ android.view.view.performclick(view.java:2408) 07-02 18:06:39.752: error/androidruntime(354): @ android.view.view$performclick.run(view.java:8816) 07-02 18:06:39.752: error/androidruntime(354): @ android.os.handler.handlecallback(handler.java:587) 07-02 18:06:39.752: error/androidruntime(354): @ android.os.handler.dispatchmessage(handler.java:92) 07-02 18:06:39.752: error/androidruntime(354): @ android.os.looper.loop(looper.java:123) 07-02 18:06:39.752: error/androidruntime(354): @ android.app.activitythread.main(activitythread.java:4627) 07-02 18:06:39.752: error/androidruntime(354): @ java.lang.reflect.method.invokenative(native method) 07-02 18:06:39.752: error/androidruntime(354): @ java.lang.reflect.method.invoke(method.java:521) 07-02 18:06:39.752: error/androidruntime(354): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:868) 07-02 18:06:39.752: error/androidruntime(354): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:626) 07-02 18:06:39.752: error/androidruntime(354): @ dalvik.system.nativestart.main(native method)
what wrong mapactivity? why not found?
my mapactivity's code:
import java.io.bufferedinputstream; import java.io.fileinputstream; import java.io.inputstream; import java.util.arraylist; import java.util.list; import javax.xml.parsers.saxparser; import javax.xml.parsers.saxparserfactory; import org.xml.sax.inputsource; import org.xml.sax.xmlreader; import android.content.context; import android.view.view; import android.view.view.onclicklistener; import android.view.inputmethod.inputmethodmanager; import android.widget.button; import android.widget.edittext; import android.widget.relativelayout; 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.overlay; import com.google.android.maps.overlayitem;
public class map extends mapactivity {
arraylist<listcellinfo> mapsearchresults=new arraylist<listcellinfo>(); mapview mapview; list<overlay> mapoverlays; mapcontroller mymapcontroller; myxmlhandler myxmlhandler = new myxmlhandler(); public static int flag=0; @override protected boolean isroutedisplayed() { return false; } @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.map); final edittext searchformap = (edittext) findviewbyid(r.id.edittextmap); button bckbtn = (button) findviewbyid(r.id.retourmap); bckbtn.setonclicklistener(new view.onclicklistener() { public void onclick(view v) { if (details.back_activity_flag == 1) { inputmethodmanager mgr = (inputmethodmanager) getsystemservice(context.input_method_service); mgr.hidesoftinputfromwindow(searchformap.getwindowtoken(), 0); intent myintent = new intent(v.getcontext(), details.class); activity1.group.replacecontentview("details", myintent); } else if (details.back_activity_flag == 2) { inputmethodmanager mgr = (inputmethodmanager) getsystemservice(context.input_method_service); mgr.hidesoftinputfromwindow(searchformap.getwindowtoken(), 0); intent myintent = new intent(v.getcontext(), details.class); activity2.group.replacecontentview("details", myintent); } else if (details.back_activity_flag == 3) { inputmethodmanager mgr = (inputmethodmanager) getsystemservice(context.input_method_service); mgr.hidesoftinputfromwindow(searchformap.getwindowtoken(), 0); intent myintent = new intent(v.getcontext(), details.class); activity3.group.replacecontentview("details", myintent); } } }); mapview = (mapview) findviewbyid(r.id.mapview); mapview.setbuiltinzoomcontrols(true); mapoverlays = mapview.getoverlays(); drawable drawable = this.getresources().getdrawable(r.drawable.black_pin_img); mapitemizedoverlay itemizedoverlay = new mapitemizedoverlay(drawable,this); /*log.v("details lattitude",(int)(details.lattitude* 1e6)+""); log.v("details longitude",(int)(details.longitude* 1e6)+"");*/ geopoint point = new geopoint((int)(details.lattitude* 1e6),(int)(details.longitude* 1e6)); mapview.setfocusable(true); mymapcontroller = mapview.getcontroller(); mymapcontroller.animateto(point); mymapcontroller.setzoom(18); mymapcontroller.setcenter(point); overlayitem overlayitem = new overlayitem(point, details.name, ""); itemizedoverlay.addoverlay(overlayitem); mapoverlays.add(itemizedoverlay); mapview.setstreetview(true); relativelayout relativelayout = (relativelayout) findviewbyid(r.id.relativelayoutmap); relativelayout.setonclicklistener(new onclicklistener() { public void onclick(view v) { inputmethodmanager mgr = (inputmethodmanager) getsystemservice(context.input_method_service); mgr.hidesoftinputfromwindow(searchformap.getwindowtoken(), 0); } }); final mapitemizedoverlay itemizedoverlay1=itemizedoverlay; button searchbtn = (button) findviewbyid(r.id.searchbuttonmap); searchbtn.setonclicklistener(new onclicklistener() { public void onclick(view v) { inputmethodmanager mgr = (inputmethodmanager) getsystemservice(context.input_method_service); mgr.hidesoftinputfromwindow(searchformap.getwindowtoken(), 0); string getsearchtext = searchformap.gettext().tostring(); if(getsearchtext.length()!=0){ string[] fav=getsearchtext.split(","); try { /** handling xml */ saxparserfactory spf = saxparserfactory.newinstance(); saxparser sp = spf.newsaxparser(); xmlreader xr = sp.getxmlreader(); /** send url parse xml tags */ inputstream inputfile; sharedpreferences flag = getsharedpreferences(isenegal.flag, mode_private); string getflag = flag.getstring("flag", ""); if(getflag.equals("0")) inputfile = getresources().openrawresource(r.raw.alldata); else inputfile = new bufferedinputstream(new fileinputstream("/sdcard/alldata.xml")); xr.setcontenthandler(myxmlhandler); xr.parse(new inputsource(inputfile)); } catch (exception e) { system.out.println("xml pasing excpetion = " + e); } for(int i=0;i<fav.length;i++){ for(int j=0;j<myxmlhandler.results.size();j++){ if(myxmlhandler.results.get(j).getsearchtag().tolowercase().contains(fav[i].tolowercase())) mapsearchresults.add(myxmlhandler.results.get(j)); } } myxmlhandler.results.clear(); if(!mapview.getoverlays().isempty()) { mapoverlays.clear(); itemizedoverlay1.moverlays.clear(); mapview.invalidate(); } if(mapsearchresults.size()>0){ geopoint cpoint = new geopoint((int)(14.745335 * 1e6),(int)(-17.42157 * 1e6)); mapview.setfocusable(true); mymapcontroller = mapview.getcontroller(); mymapcontroller.animateto(cpoint); mymapcontroller.setzoom(7); mymapcontroller.setcenter(cpoint); for(int k=0;k<mapsearchresults.size();k++){ geopoint point1 = new geopoint((int)((mapsearchresults.get(k).getlatitude())* 1e6),(int)((mapsearchresults.get(k).getlongitude())* 1e6)); overlayitem overlayitem1 = new overlayitem(point1, mapsearchresults.get(k).getname(), ""); itemizedoverlay1.addoverlay(overlayitem1); mapoverlays.add(itemizedoverlay1); } mapview.invalidate(); mapsearchresults.clear(); } } } }); }
}
my manifest file's code:
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.x.isenegal" android:versioncode="1" android:versionname="1.0"> <uses-sdk android:minsdkversion="8" /> <uses-permission android:name="android.permission.access_fine_location" /> <uses-permission android:name="android.permission.access_mock_location" /> <uses-permission android:name="android.permission.access_coarse_location" /> <uses-permission android:name="android.permission.write_external_storage"/> <uses-permission android:name="android.permission.internet"/> <uses-permission android:name="android.permission.access_network_state"/> <uses-permission android:name="android.permission.read_phone_state"/> <application android:icon="@drawable/icon" android:label="@string/app_name"> <uses-library android:name="com.google.android.maps" /> <activity android:name=".isenegal" android:theme="@android:style/theme.notitlebar.fullscreen" android:label="@string/app_name" android:configchanges="keyboardhidden|orientation" android:screenorientation="portrait"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:configchanges="keyboardhidden|orientation" android:screenorientation="portrait" android:name="activity1" android:theme="@android:style/theme.notitlebar.fullscreen"></activity> <activity android:configchanges="keyboardhidden|orientation" android:screenorientation="portrait" android:name="activity2" android:theme="@android:style/theme.notitlebar.fullscreen"></activity> <activity android:configchanges="keyboardhidden|orientation" android:screenorientation="portrait" android:name="activity3" android:theme="@android:style/theme.notitlebar.fullscreen"></activity> <activity android:configchanges="keyboardhidden|orientation" android:screenorientation="portrait" android:name="activity4" android:theme="@android:style/theme.notitlebar.fullscreen"></activity> <activity android:configchanges="keyboardhidden|orientation" android:screenorientation="portrait" android:name="activity5" android:theme="@android:style/theme.notitlebar.fullscreen"></activity> <activity android:configchanges="keyboardhidden|orientation" android:screenorientation="portrait" android:name="categories" android:theme="@android:style/theme.notitlebar.fullscreen"></activity> <activity android:configchanges="keyboardhidden|orientation" android:screenorientation="portrait" android:name="results" android:theme="@android:style/theme.notitlebar.fullscreen"></activity> <activity android:configchanges="keyboardhidden|orientation" android:screenorientation="portrait" android:name="details" android:theme="@android:style/theme.notitlebar.fullscreen"></activity> <activity android:configchanges="keyboardhidden|orientation" android:screenorientation="portrait" android:name="favoris" android:theme="@android:style/theme.notitlebar.fullscreen"></activity> <activity android:configchanges="keyboardhidden|orientation" android:screenorientation="portrait" android:name="recherche" android:theme="@android:style/theme.notitlebar.fullscreen"></activity> <activity android:configchanges="keyboardhidden|orientation" android:screenorientation="portrait" android:name="searchresults" android:theme="@android:style/theme.notitlebar.fullscreen"></activity> <activity android:configchanges="keyboardhidden|orientation" android:screenorientation="portrait" android:name="map" android:theme="@android:style/theme.notitlebar.fullscreen"></activity> </application>
are using google add-on map activity(for maps should use google add-on),check whether using or not.if using check u have line "import com.google.android.maps.mapactivity;" in source code instead "java.util.map",map , mapactivity both different.can post code snippet more information.
Comments
Post a Comment