Note that there are some explanatory texts on larger screens.

plurals
  1. POandroid map application stopped unexpecdly and to force close
    primarykey
    data
    text
    <p>I Have android Map application and Testing it On Android Emulator.Problem is that when I Run It In Emulator It Stopped Unexpectdly.However Inernet is Working On Emulator.Here is My Log Cat.</p> <pre><code>06-24 21:40:42.285: D/dalvikvm(371): GC_CONCURRENT freed 377K, 48% free 3039K/5831K, external 716K/1038K, paused 7ms+8ms 06-24 21:40:42.755: D/dalvikvm(371): GC_CONCURRENT freed 579K, 50% free 3019K/6023K, external 716K/1038K, paused 6ms+7ms 06-24 21:40:43.015: D/dalvikvm(371): GC_CONCURRENT freed 299K, 47% free 3232K/6023K, external 716K/1038K, paused 7ms+8ms 06-24 21:40:43.285: D/dalvikvm(371): GC_CONCURRENT freed 468K, 47% free 3318K/6215K, external 716K/1038K, paused 6ms+10ms 06-24 21:40:43.575: D/dalvikvm(371): GC_CONCURRENT freed 434K, 46% free 3416K/6279K, external 717K/1038K, paused 5ms+5ms 06-24 21:41:04.119: E/log_tag(371): Error in http connectionjava.net.UnknownHostException: sml.com.pk 06-24 21:41:04.125: E/log_tag(371): Error converting result java.lang.NullPointerException 06-24 21:41:04.145: D/AndroidRuntime(371): Shutting down VM 06-24 21:41:04.145: W/dalvikvm(371): threadid=1: thread exiting with uncaught exception (group=0x40015560) 06-24 21:41:04.175: E/AndroidRuntime(371): FATAL EXCEPTION: main 06-24 21:41:04.175: E/AndroidRuntime(371): java.lang.RuntimeException: Unable to start activity ComponentInfo{map2.pkg.pkg/map2.pkg.pkg.GMapsActivity}: java.lang.NullPointerException 06-24 21:41:04.175: E/AndroidRuntime(371): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647) 06-24 21:41:04.175: E/AndroidRuntime(371): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663) 06-24 21:41:04.175: E/AndroidRuntime(371): at android.app.ActivityThread.access$1500(ActivityThread.java:117) 06-24 21:41:04.175: E/AndroidRuntime(371): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931) 06-24 21:41:04.175: E/AndroidRuntime(371): at android.os.Handler.dispatchMessage(Handler.java:99) 06-24 21:41:04.175: E/AndroidRuntime(371): at android.os.Looper.loop(Looper.java:130) 06-24 21:41:04.175: E/AndroidRuntime(371): at android.app.ActivityThread.main(ActivityThread.java:3683) 06-24 21:41:04.175: E/AndroidRuntime(371): at java.lang.reflect.Method.invokeNative(Native Method) 06-24 21:41:04.175: E/AndroidRuntime(371): at java.lang.reflect.Method.invoke(Method.java:507) 06-24 21:41:04.175: E/AndroidRuntime(371): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 06-24 21:41:04.175: E/AndroidRuntime(371): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 06-24 21:41:04.175: E/AndroidRuntime(371): at dalvik.system.NativeStart.main(Native Method) 06-24 21:41:04.175: E/AndroidRuntime(371): Caused by: java.lang.NullPointerException 06-24 21:41:04.175: E/AndroidRuntime(371): at org.json.JSONTokener.nextCleanInternal(JSONTokener.java:112) 06-24 21:41:04.175: E/AndroidRuntime(371): at org.json.JSONTokener.nextValue(JSONTokener.java:90) 06-24 21:41:04.175: E/AndroidRuntime(371): at org.json.JSONArray.&lt;init&gt;(JSONArray.java:87) 06-24 21:41:04.175: E/AndroidRuntime(371): at org.json.JSONArray.&lt;init&gt;(JSONArray.java:103) 06-24 21:41:04.175: E/AndroidRuntime(371): at map2.pkg.pkg.GMapsActivity.onCreate(GMapsActivity.java:112) 06-24 21:41:04.175: E/AndroidRuntime(371): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 06-24 21:41:04.175: E/AndroidRuntime(371): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611) 06-24 21:41:04.175: E/AndroidRuntime(371): ... 11 more 06-24 21:41:11.605: I/Process(371): Sending signal. PID: 371 SIG: 9 </code></pre> <p>And Here is mY Manifiest.xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="map2.pkg.pkg" android:versionCode="1" android:versionName="1.0" android:installLocation="auto"&gt; &lt;uses-sdk android:minSdkVersion="10"/&gt; &lt;uses-permission android:name="android.permission.INTERNET"/&gt; &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/&gt; &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/&gt; &lt;application android:icon="@drawable/icon" android:label="@string/app_name"&gt; &lt;activity android:name=".GMapsActivity" android:label="@string/app_name"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;uses-library android:name="com.google.android.maps" /&gt; &lt;/application&gt; &lt;/manifest&gt; </code></pre> <p>Can Any One Tell Me What Exaclty is the issue and Why The Application is not Running On Emulator.</p> <p><strong>Update</strong></p> <p>GMapsActivity</p> <pre><code>package map2.pkg.pkg; import java.util.List; import android.graphics.drawable.Drawable; import android.net.ParseException; 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.Overlay; import com.google.android.maps.OverlayItem; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import android.util.Log; public class GMapsActivity extends MapActivity { private MapView mapView; EditText password; Button login; TextView vwpass; JSONArray jArray; String result = null; InputStream is = null; StringBuilder sb=null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); password=(EditText)findViewById(R.id.pass); login=(Button)findViewById(R.id.login); //vwpass=(Button)findViewById(R.id.textView1); mapView = (MapView) findViewById(R.id.map_view); mapView.setBuiltInZoomControls(true); login.setOnClickListener(new View.OnClickListener(){ public void onClick(View v) { if(password.getText().toString().equals("tsml")) { mapView.setVisibility(View.VISIBLE); login.setVisibility(View.INVISIBLE); password.setVisibility(View.INVISIBLE); // vwpass.setVisibility(View.INVISIBLE); } else { Toast.makeText(getBaseContext(), "invalid password - try again", Toast.LENGTH_SHORT).show(); } } }); ArrayList&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(); //http post try{ HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://221.120.216.52/a/map.php"); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); is = entity.getContent(); }catch(Exception e){ Log.e("log_tag", "Error in http connection"+e.toString()); } //convert response to string try{ BufferedReader reader = new BufferedReader(new InputStreamReader(is,"iso-8859-1"),8); sb = new StringBuilder(); sb.append(reader.readLine() + "\n"); String line="0"; while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } is.close(); result=sb.toString(); }catch(Exception e){ Log.e("log_tag", "Error converting result "+e.toString()); } //paring data double LAT; double LANG; String INFO; try{ jArray = new JSONArray(result); JSONObject json_data=null; for(int i=0;i&lt;jArray.length();i++){ json_data = jArray.getJSONObject(i); LAT=json_data.getDouble("lat"); LANG=json_data.getDouble("lang"); INFO=json_data.getString("info"); //Overlay code List&lt;Overlay&gt; mapOverlays = mapView.getOverlays(); Drawable drawable = this.getResources().getDrawable(R.drawable.icon); CustomItemizedOverlay itemizedOverlay = new CustomItemizedOverlay(drawable, this); //GeoPoint point = new GeoPoint(latitudeE6, longitudeE6); GeoPoint point = new GeoPoint((int)(LAT * 1e6),(int)(LANG * 1e6)); OverlayItem overlayitem = new OverlayItem(point, "Shakarganj", INFO); itemizedOverlay.addOverlay(overlayitem); mapOverlays.add(itemizedOverlay); MapController mapController = mapView.getController(); mapController.animateTo(point); mapController.setZoom(6); //Overlay code } } catch(JSONException e1){ Toast.makeText(getBaseContext(), "No Vehicles Found" ,Toast.LENGTH_LONG).show(); } catch (ParseException e1) { e1.printStackTrace(); } } @Override protected boolean isRouteDisplayed() { return false; } } </code></pre> <p><strong>Layout</strong></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;com.google.android.maps.MapView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/map_view" android:layout_width="fill_parent" android:layout_height="fill_parent" android:apiKey="0nSh8sjwyA39DgDkjMLZJYR101K2WKvcldQX1wA" android:clickable="true" android:enabled="true" android:visibility="invisible" /&gt; &lt;EditText android:id="@+id/pass" android:layout_width="wrap_content" android:layout_height="wrap_content" android:inputType="textPassword" android:width="150dp" android:gravity="center_horizontal" /&gt; &lt;Button android:id="@+id/login" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/pass" android:layout_marginLeft="44dp" android:text="@string/log" /&gt; &lt;/RelativeLayout&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload