How To Reduce Android Activity And App Size?
I'm new at android devolpment, so I am developing an alphabet app for an old language, the app would look like this first page has a picture and two buttons first button links to
Solution 1:
You can pass data into activities and fragments in Android, there is no need to create multiple activities that have a similar function.
If you decide to use an Activity you can pass data via an Intent
which can contain extras, e.g.
Intent intent = newIntent(this, NextActivity.class);
intent.putExtra("image_id", R.drawable.some_letter);
intent.putExtra("audio_file", "some_letter.mp3");
startActivity(intent);
Similarly, you can pass a Bundle
of arguments to a fragment:
Fragmentfragment=newNextFragment();
Bundleargs=newBundle();
args.putInt("image_id", R.drawable.some_letter);
args.putString("audio_file", "some_letter.mp3");
fragment.setArguments(args);
....
Solution 2:
Regardless of the size, it sounds like you would greatly benefit from using fragments in your architecture. Android Fragments
If 50 images and 24 audio files add up to too much, you might want to check the resolution of the images and/or the compression of your audio files. How much is too much?
Post a Comment for "How To Reduce Android Activity And App Size?"