Note that there are some explanatory texts on larger screens.

plurals
  1. POApp crashes with out giving any error
    primarykey
    data
    text
    <p>I am reading files from server. My app crashes and my logcat is also not showing any error. I was getting window leaked error before that but when i comment my dialog code then i am not getting any error in my logcat.</p> <p>Server code is as follows:</p> <pre><code>public class serv extends ListActivity { private String m_urlString="http://192.168.1.30/muneem/muneem.php?path=./"; // private String result; private List&lt;String&gt; m_item = null; private List&lt;String&gt; m_path = null; private String m_root="http://192.168.1.30/muneem/muneem.php?path=./"; private String m_result; private TextView m_myPath; static private String m_pos; private String m_backposition; private String m_fileURL; int m_downloadedSize = 0; int m_totalSize = 0; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.file_chooser); View v= findViewById(R.id.rowtext); m_myPath = (TextView)findViewById(R.id.path); m_fileURL="http://192.168.1.30/muneem/"; Http_connection f=new Http_connection(); f.execute(""); } class Http_connection extends AsyncTask&lt;String, Void, Void&gt; { private Exception exception; protected Void doInBackground(String... urls) { try { URL url= new URL(m_urlString); HttpURLConnection con=(HttpURLConnection)url.openConnection(); con.setRequestMethod("GET"); con.connect(); int statusCode=con.getResponseCode(); if (statusCode==HttpURLConnection.HTTP_OK){ BufferedReader in= new BufferedReader(new InputStreamReader(con.getInputStream())); String line; m_result=""; while ((line=in.readLine())!=null) { m_result=m_result+"\n"+line; } in.close(); con.disconnect(); runOnUiThread(new Runnable() { @Override public void run() { getDir(m_urlString); } }); } } catch (MalformedURLException e) { // bundle.putString("Error","Problem with URL"); } catch (IOException e) { // bundle.putString("Error","Problem with connection"); } return null; } } private void getDir(String dirPath) { String[] r=m_result.split("/"); m_myPath.setText("Location: " + dirPath); m_item = new ArrayList&lt;String&gt;(); m_path = new ArrayList&lt;String&gt;(); for (int k=0;k&lt;r.length;k++) { if (r[k].contains(".")) { m_item.add(r[k]); } else { m_item.add(r[k]+"/"); } } ArrayAdapter&lt;String&gt; fileList = new ArrayAdapter&lt;String&gt;(serv.this, R.layout.row, m_item); setListAdapter(fileList); } class getfile extends AsyncTask&lt;String, Void, Void&gt; { private Exception exception; protected Void doInBackground(String... urls) { int count=0; try { // urlSt="http://192.168.1.30/muneem/oglPrahova/prahova.GIS"; // URL uurl = new URL("http://192.168.1.30/muneem/oglPrahova/prahova.GIS"); URL uurl = new URL(m_fileURL); BufferedReader in = new BufferedReader(new InputStreamReader(uurl.openStream())); String text_file=""; String str; while ((str = in.readLine()) != null) { text_file=text_file+str; } in.close(); AppFuncs.g_path=text_file; AppFuncs.g_urlstring=m_urlString; } </code></pre> <p>Map Activity calling server code is as follows:</p> <pre><code>public class Map extends Activity { // private GraphicsView mGLView; //private GisGLRenderer m_GisRenderer; final static String RESULT_KEY="result"; final static int REQ_CODE=1001; AlertDialog m=null; public class LoadFile extends AsyncTask&lt;String,String,String&gt; { ProgressDialog Asycdialog = new ProgressDialog(Map.this); @Override protected void onPreExecute() { //set message of the dialog Asycdialog.setMessage("Loading File"); Asycdialog.setButton(DialogInterface.BUTTON_NEGATIVE,"Cancel",new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { //To change body of implemented methods use File | Settings | File Templates. } }); super.onPreExecute(); } protected void onProgressUpdate(String ... progress) { } protected String doInBackground(String ... Params) { Map.this.mGLView.LoadProjectFile(AppFuncs.g_path); Map.this.mGLView.requestRender(); return null; } protected void onPostExecute(String result) { } } public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_map); mGLView = (GraphicsView) findViewById(R.id.glview); } public void bt_Open(View v) { AlertDialog.Builder builder=new AlertDialog.Builder(this); builder.setTitle("Load File"); builder.setMessage("Choose an option to load file") .setCancelable(false) .setNegativeButton("Server",new DialogInterface.OnClickListener(){ public void onClick(DialogInterface dialog,int which) { Intent i= new Intent(Map.this,serv.class); startActivityForResult(i,REQ_CODE); } } ) .setPositiveButton("SDcard",new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { Intent i= new Intent(Map.this,FileChooser.class); startActivityForResult(i,REQ_CODE); } } ); final AlertDialog a=builder.create(); a.show(); } protected void onActivityResult(int requestCode, int resultCode,Intent data) { //super.onActivityResult(requestCode,resultCode,data); if(requestCode==REQ_CODE) { if(resultCode==RESULT_OK &amp;&amp; data.getExtras().containsKey(RESULT_KEY)) { // Toast.makeText(this,data.getExtras().getString(RESULT_KEY),Toast.LENGTH_SHORT).show(); // this.mGLView.m_SelectedProjectPath = AppFuncs.path; LoadFile f= new LoadFile(); f.execute(""); // this.mGLView.LoadProjectFile(AppFuncs.path); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
 

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