Android ° ***********************************************
± ¾ Õ Â ¹ óó Intent £;%» Ø»
Á÷ ³ £°
Æ ô ¶ öö ³-> ° 'ï  ° 'ü Æ ¶ µ ¸ Ö öactivity-> ä äè ë Ó» § £;° ' OK °' ü U->» Ø '«Ó û § à û» ööö Ò ³-> ö÷ ³ ¶ áè ¡Ó Ã» § à û ² ¢ £ ¾ ö öà '£.
1) Then ~~~ö~~~í ~£°
2) When there are too many maid activity
3 Ê äè Ó Ã» § £ £°
4» Ø '?
 ¨ ä¿ £;%%%» ° ó Ê äâ Ó ó Ó µ £" http://www.bkjia.com/kf/ware/vc/ "target =" _ blank "class =" keylink "> vcD4KPHA + Asn + CjxwPjxwcmUgY2xhc3M9" brush: java; ">
¨ Ulᢠһ ö öbutton £;;» ° oröö ¨ à ± onon
2 ö ~~~*******************************************************************
public class MainActivity extends Activity {/* * An integer value that identifies an activity you are calling. * When an Activity returns a value, you must have a way to identify it * If the request code is set to -1, then calling it using the * startActivityForResult() method is equivalent to calling it using * the startActivity() method. That is, no result will be returned. */int requestCode = 1;public static
boolean equ(T t1, T t2){return t1 == t2;} @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } public void onClick(View view){ startActivityForResult(new Intent("su.bill.intenttest.SecondaryActivity"), requestCode); }}
Õ â À ï °í ;» ° ã µästartactivity ²» Ó Ã µälanguíç?******************* startActivityForResult £ ;*********** ° ¯ Ê ******************
3. **********************************************************************
Please refer to the following link for more information: {0}. {0}. {0}. {0}. {0}. {0 }.
4 µú~~~öactivity µäâ ~~~~â ~~
package com.example.intenttest;import android.app.Activity;import android.content.Intent;import android.net.Uri;import android.os.Bundle;import android.view.View;import android.widget.EditText;public class SecondaryActivity extends Activity {@Overridepublic void onCreate(Bundle savedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.secondary_activity);}public void onClick(View v){Intent data = new Intent();EditText txt_username = (EditText) findViewById(R.id.txt_username);data.setData(Uri.parse(txt_username.getText().toString()));setResult(RESULT_OK, data);finish();}}
Ö÷ Ò Ç çonclick 'úâ £ £%%%%%â %%%%%%%» Ö öintent data %%%%%%%%%%%%%%%%%%%%%%%%%%intent %%%%%% ääúè {£;è» ° ózó ó Ó Ã setResult» Ø '«â ö öintent {öö activity £ä Ä äµ μ» ← *
5ö~~~~â %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@Override public void onActivityResult(int reqCode, int resCode, Intent data) { if (equ(reqCode, requestCode) && equ(resCode, RESULT_OK)){ Toast.makeText(this, data.getDataString(), Toast.LENGTH_SHORT).show(); } }'Óé zookeeper» ö ö¶ ózózäactivity · µ» Ø µä± ± ° **í × ******** *********************************** ä° {{£%%%äö%µä± í%%%%%%%° ********************************************** reqCode **************************************activity · μ» Ø maid
Ö÷ Ò ³ Â {% *****************************************************************
package com.example.intenttest;import android.app.Activity;import android.content.Intent;import android.os.Bundle;import android.view.Menu;import android.view.MenuItem;import android.view.View;import android.widget.Toast;public class MainActivity extends Activity {/* * An integer value that identifies an activity you are calling. * When an Activity returns a value, you must have a way to identify it * If the request code is set to -1, then calling it using the * startActivityForResult() method is equivalent to calling it using * the startActivity() method. That is, no result will be returned. */int requestCode = 1;public static
boolean equ(T t1, T t2){return t1 == t2;} @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } public void onClick(View view){ startActivityForResult(new Intent("su.bill.intenttest.SecondaryActivity"), requestCode); } @Override public void onActivityResult(int reqCode, int resCode, Intent data) { if (equ(reqCode, requestCode) && equ(resCode, RESULT_OK)){ Toast.makeText(this, data.getDataString(), Toast.LENGTH_SHORT).show(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); }}
Ä äë û û Ë µ½ μäúâ Ë Ç ¨ Ä µ ±? **********************************************************************
Guílanguc has just been upgraded ° choose Android µää» copyright» úö~£ **************************** ma'än ma'zäzäz£4, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000, 000
Ë µ° Ç ç° È Õ £ À? ò Î ª» Ó Ð ° U ¶ à ä äë û Ç Â çé ×ö¡ £.
********************************************************** £ **********************************************************************