Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid: startActivityForResult does not show/display the sub-activity?
    primarykey
    data
    text
    <p>I am trying to use <strong>startActivityForResult()</strong> to start an activity and then return back to main activity after displaying it and saving any changes in the sub-activity. I saw questions where people were not able to get result from the sub activity. However, I am not even able to display my sub-activity.</p> <p>I have checked for exceptions. Nothing there and my class is registered/exists in the Manifest file too.</p> <p>Below are my code files.</p> <p>Main:</p> <pre><code>package com.connectionmanager.app; import android.app.Activity; import android.app.Dialog; import android.content.ContentValues; import android.content.Intent; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; public class CMapp extends Activity implements OnClickListener { protected void onActivityResult (int requestCode, int resultCode, Intent data) { Log.v("Hello","From onActivityResult"); } /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); //Some code // Bring up a new activity for result Intent appSetup = new Intent(CMapp.this, AppSetup.class); try { startActivityForResult(appSetup, 0); } catch (Exception e) { Log.v("Hello","Exception E:" + e.toString()); } /*@Override*/ public void onClick(DialogInterface arg0, int arg1) { // TODO Auto-generated method stub if(arg1 == -1) { //Some code } else { finish(); } } } </code></pre> <p>AppSetup</p> <pre><code>package com.connectionmanager.app; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; public class AppSetup extends Activity implements OnClickListener { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.app_setup); Log.v("Hello","Bringing up application setup Dialog box"); //Set up buttons Button btnSave = (Button) findViewById(R.id.ButtonSave); Button btnContinue = (Button) findViewById(R.id.ButtonContinue); btnSave.setOnClickListener(this); btnContinue.setOnClickListener(this); } @Override public void onClick(View arg0) { // TODO Auto-generated method stub if(arg0.getId() == (R.id.ButtonSave)) { this.finish(); } } } </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.
    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