Simple example for Intent and Bundle [duplicate]

For example : In MainActivity : Intent intent = new Intent(this, OtherActivity.class); intent.putExtra(OtherActivity.KEY_EXTRA, yourDataObject); startActivity(intent); In OtherActivity : public static final String KEY_EXTRA = “com.example.yourapp.KEY_BOOK”; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); String yourDataObject = null; if (getIntent().hasExtra(KEY_EXTRA)) { yourDataObject = getIntent().getStringExtra(KEY_EXTRA); } else { throw new IllegalArgumentException(“Activity cannot find extras ” + KEY_EXTRA); } … Read more

SavedInstanceState is always null in fragment

All the problem was in that I don’t declare android:id for the fragment in XML. Android needs ID or TAG to recognize stored fragment and reproduce all elements in it. So guys, remember – every instance of fragment needs unique id or tag! Also, when setRetainInstance(true) is declared then bundle should always return null.

Unable to resolve module ‘AccessibilityInfo’, when trying to create release bundle

It seems like a bug in 0.56 related to dependencies. The “solution” is to find the correct combination of dependencies’ versions. We found a workaround by installing those versions EXACTLY: react-native >> 0.55.4 babel-core >> latest babel-loader >> latest babel-preset-react-native >> 4.0.0 So you have to run those commands in order: react-native init AwesomeProject cd … Read more

git bundle: bundle tags and heads

git bundle create RA.bundle –branches –tags would include informations about all tags and all branches. git bundle takes a list of arguments, acceptable to git rev-parse and git rev-list (and containing a named ref, see SPECIFYING REFERENCES), that specifies the specific objects and references to transport. –branches[=<pattern>] Pretend as if all the refs in refs/heads … Read more

IOS: copy a file in documents folder

Copies txtFile from resource to document if not already present. NSFileManager *fileManager = [NSFileManager defaultManager]; NSError *error; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *txtPath = [documentsDirectory stringByAppendingPathComponent:@”txtFile.txt”]; if ([fileManager fileExistsAtPath:txtPath] == NO) { NSString *resourcePath = [[NSBundle mainBundle] pathForResource:@”txtFile” ofType:@”txt”]; [fileManager copyItemAtPath:resourcePath toPath:txtPath error:&error]; } If you want to … Read more

Symfony2 – creating own vendor bundle – project and git strategy

Create a new empty symfony project php composer.phar create-project symfony/framework-standard-edition demo/ 2.4.1 cd demo Generate a new bundle (for example src/Company/DemoBundle) php app/console generate:bundle cd src/Company/DemoBundle/ Init your github repository in src/Company/DemoBundle git init touch README.md git add . git commit -m “initial commit” git remote add origin https://github.com/YourAccount/DemoBundle.git git push -u origin master Add … Read more