[size=medium][b]How to start an Intent?[/b][/size]
[img]http://developer.android.com/images/activity_lifecycle.png[/img]
[size=medium][b]Saving activity state[/b][/size]
[img]http://developer.android.com/images/fundamentals/restore_instance.png[/img]
There's no guarantee that onSaveInstanceState() will be called before your activity is destroyed, If the system calls onSaveInstanceState(), it does so before onStop() and possibly before onPause().
Because the default implementation of onSaveInstanceState() helps save the state of the UI, if you override the method in order to save additional state information, you should always call the superclass implementation of onSaveInstanceState() before doing any work. Likewise, you should also call the supercall implementation of onRestoreInstanceState() if you override it, so the default implementation can restore view states.
A good way to test your application's ability to restore its state is to simply rotate the device so that the screen orientation changes.
Intent intent = new Intent(this, SignInActivity.class);
startActivity(intent);
Intent Intent = new Intent();
Intent.setComponent(new ComponentName(pkgName, activityName));
Intent Intent = new Intent();
Intent.setClassName(String pkgName, String activityName);
//Activity Send
Intent intent = new Intent(Intent.ACTION_SEND);
Intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.putExtra("apkpath", "/mnt/sdcard/apkinstall");
startActivity(intent);
//Activity Receive
Intent intent = getIntent();
intent.hasExra("apkpath");
String recevieValue = intent.getStringExtra("apkpath");
File file = new File(recevieValue);
if(file.exists()){
Toast.makeText(this, "OK", Toast.LENGTH_SHORT).show();
}
//Send
static final private int GET_CODE = 0;
startActivityForResult(intent, GET_CODE);
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == GET_CODE){
if (resultCode == RESULT_CANCELED){}
else {System.out.println("data.getData() " + data.getAction());}
}
}
//Receive
setResult(RESULT_OK, (new Intent()).setAction("Corky!"));
[img]http://developer.android.com/images/activity_lifecycle.png[/img]
[size=medium][b]Saving activity state[/b][/size]
[img]http://developer.android.com/images/fundamentals/restore_instance.png[/img]
There's no guarantee that onSaveInstanceState() will be called before your activity is destroyed, If the system calls onSaveInstanceState(), it does so before onStop() and possibly before onPause().
Because the default implementation of onSaveInstanceState() helps save the state of the UI, if you override the method in order to save additional state information, you should always call the superclass implementation of onSaveInstanceState() before doing any work. Likewise, you should also call the supercall implementation of onRestoreInstanceState() if you override it, so the default implementation can restore view states.
A good way to test your application's ability to restore its state is to simply rotate the device so that the screen orientation changes.