hey NightGospel, thnx...for this
On May 31, 4:02 pm, NightGospel <[email protected]> wrote: > Hi Dixit, > > You can put values to the intent by invoking Intent.putExtra() method > and retrieve it by invoking Intent.getXXXExtra(). > For example, > in one.java: > Intent myIntent = new Intent(view.getContext(),two.class); > myIntent.putExtra("url", "http://www.newkerala.com"); > startActivityForResult(myIntent, 0); > > in two.java: > Intent intent = getIntent(); > URL url = new URL(intent.getStringExtra("url")); > > Please refer > tohttp://developer.android.com/reference/android/content/Intent.html > to get more information. > > NightGospel > > On 5月31日, 下午3時58分, Dixit Wadhwani <[email protected]> wrote: > > > > > * > > one.java: > > > import android.app.Activity; > > import android.content.Intent; > > import android.os.Bundle; > > import android.view.View; > > import android.widget.Button; > > > public class one extends Activity > > { > > Button click; > > Button click1; > > /** Called when the activity is first created. */ > > public void onCreate(Bundle savedInstanceState) > > { > > super.onCreate(savedInstanceState); > > setContentView(R.layout.main2); > > > click = (Button) findViewById(R.id.click); > > click.setOnClickListener(new View.OnClickListener() > > { > > public void onClick(View view) > > { > > Intent myIntent = new Intent(view.getContext(),two.class); > > startActivityForResult(myIntent, 0); > > } > > > }); > > click1 = (Button) findViewById(R.id.click); > > click1.setOnClickListener(new View.OnClickListener() > > { > > public void onClick(View view) > > { > > Intent myIntent = new Intent(view.getContext(),two.class); > > startActivityForResult(myIntent, 0); > > } > > > }); > > } > > > } > > > two.java: > > > import android.app.ListActivity; > > import android.content.Intent; > > import android.os.Bundle; > > import android.view.View; > > import android.widget.TextView; > > > public class two extends ListActivity { > > > /** Called when the activity is first created. */ > > @Override > > public void onCreate(Bundle savedInstanceState) > > { > > super.onCreate(savedInstanceState); > > setContentView(R.layout.mains); > > > try { > > URL Url = new URL("http://www.newkerala.com"); > > > } > > > catch (IOException e) ..................... > > { > > e.printStackTrace();} > > > .................. > > ................ > > ............... > > ............. > > > } > > > Now what i want whenever i select a button from one.java file it should pass > > the URL in two.java and the URL is defined in one.java. In other words how > > can i pass the different-different URL on the different-differentbutton > > > * -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

