onActivityResult the use-value

sponsored links
Sometimes the groups have added new people always like to ask some questions sometimes do not answer the past because of the frequency response more

Does not answer it against people who let their contact with the enthusiasm of the early strength in order to save or do simple things to it as a guide articles

More activity by value between the fact onActivityResult, then do not forget there is an action of the problem is in the main xml add your own action in order to facilitate identification, do not forget the last time activity finansh.

public class Wizard extends Activity {

    private TextView step1result, step2result, step3result;

    public static final String INTENT_STEP1 = "com.novoda.STEP1";
    public static final String INTENT_STEP2 = "com.novoda.STEP2";
    public static final String INTENT_STEP3 = "com.novoda.STEP3";

    private static final int STEP1 = 1;
    private static final int STEP2 = 2;
    private static final int STEP3 = 3;

    public void onCreate(Bundle savedInstanceState) {
        this.step1result = (TextView)findViewById(R.id.step1result);
        this.step2result = (TextView)findViewById(R.id.step2result);
        this.step3result = (TextView)findViewById(R.id.step3result);  
        startActivityForResult(new Intent(Wizard.INTENT_STEP1), STEP1);        
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        switch (requestCode) {
            case STEP1:
                startActivityForResult(new Intent(Wizard.INTENT_STEP2), STEP2);    
            case STEP2:
                startActivityForResult(new Intent(Wizard.INTENT_STEP3), STEP3);    
            case STEP3:

public class Step1 extends Activity {

    public void onCreate(Bundle savedInstanceState) {

        Button nextStep = (Button)findViewById(R.id.goto2);
        nextStep.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Intent it = new Intent();
                it.putExtra("STEP1RESULT", ((EditText)findViewById(R.id.step1value)).getText()
                setResult(Activity.RESULT_OK, it);

The back are the same the step2 step3

Then there is the main xml

<application android:icon="@drawable/icon" android:label="@string/app_name">
                <activity android:name=".Wizard" android:label="@string/app_name">
                                <action android:name="android.intent.action.MAIN" />
                                <category android:name="android.intent.category.LAUNCHER" />

                <activity android:name=".Step1" android:label="Step1">
                                <action android:name="com.novoda.STEP1" />
                                <category android:name="android.intent.category.DEFAULT" />

                <activity android:name=".Step2" android:label="Step2">
                                <action android:name="com.novoda.STEP2" />
                                <category android:name="android.intent.category.DEFAULT" />

                <activity android:name=".Step3" android:label="Step3">
                                <action android:name="com.novoda.STEP3" />
                                <category android:name="android.intent.category.DEFAULT" />
        <uses-sdk android:minSdkVersion="7" />
  • del.icio.us
  • StumbleUpon
  • Digg
  • TwitThis
  • Mixx
  • Technorati
  • Facebook
  • NewsVine
  • Reddit
  • Google
  • LinkedIn
  • YahooMyWeb

Related Posts of onActivityResult the use-value

  • ajax implementation struts2.1 communication

    First of all go download http://code.google.com/p/jsonplugin/downloads/list first Also rememberPlus buried strtus lib inside the official jar on the json packet Then add the test action Pages jqurey Medium struts.xml add And try

  • DWR Demo

    Dwr.jar download under the lib on Medium in web.xml add the following code: Category deal with the preparation of background: DwrTest.java and the introduction of category DwrTestForm.java Add dwr.xml with the preparation of a web.xml directory: Prep ...

  • struts2 ajax verify the existence of input values

    struts2 ajax verify the existence of input values Today to do the struts2 ajax validate input regarding the existence of the function, and now share with everyone, I hope everyone many opinions!!! input.jsp page code: <html> <body> <s: ...

  • Hibernate access picture sample

    General web users to upload picture at treatment would normally uses two types of strategies: First, put directly into the picture in the database Blob field; II database are stored only at the picture on the path of the server information?, Pictures stor

  • hibernate query cache

    hibernate query cache Query cache is cached result set of common property On the entity object cache only the result set id Query cache life cycle, when the associated table happened to amend, then the query cache of the life cycle of The End Query cache

  • hibernate how to store binary, image and other major fields.

    model categories: reportByte binary type for the database fields. public class PfReportStyle implements java.io.Serializable , Cloneable { // Fields /** * */ private static final long serialVersionUID = 1L; private Long id; private byte[] reportByte; // C

  • hibernate study of the second

    Persistence of three main points: 1, a statement for persistent fields accessors (accessors) and whether the variable signs (mutators) Property statement is not necessarily required for the public's. Hibernate can be default, protected or private ...

  • hibernate (jpa) composite primary key annotation statement Ways

    In the design of the database tables are designed with a composite primary key of the table, that table's record by more than one field joint identification, such as: Table CREATE TABLE TB_HOUR_DATA ( STAT_DATE DATE NOT NULL, PATH_ID NUMBER(20) NOT NULL,

  • jboss ejb3 Message Driven Bean

    Super Medium ejb hate. . . . . . . . . . . . . . . . . . . ================================================ To configure a Message Driven Bean in a different application server parameters are not the same. Currently only passed the test jboss. Message Dri

  • hibernate generic generic DAO

    package org.lzpeng.dao; import java.io.Serializable; import java.util.List; import org.hibernate.Criteria; import org.hibernate.Query; import org.hibernate.criterion.Criterion; import org.springside.modules.orm.hibernate.Page; /** * * @version 2009-1-10 *

blog comments powered by Disqus
Recent Entries
Tag Cloud
Random Entries