Startactivity(intent) Is Doing Nothing
I'm trying to start an activity with a switch statement like that: public class MainActivity extends AppCompatActivity { public static String key = '1010'; private Bitmap
Solution 1:
I think the problem is this line
intent.putExtra(key, bitmap);
Android limits size in intent's data. There are 2 cases
- The app will crash with a
RuntimeException
, you can easily see this exception in logcat like below screenshot
- The app won't crash but showing nothing and back to home screen (your case). Actually there is a warning about this issue, to see the warning you must change logcat type to Warn and logcat filter to No Filters like below screenshot.
As you can see the warning like, 812104
in my case, it might be different in your case.
android.os.TransactionTooLargeException: data parcel size 812104 bytes
Solutions: If you need to pass a bitmap from an activity to another
- If the bitmap is a URL (file path, http/https links, etc) or a resource id (R.drawable.splash_screen, etc) then just pass the URL or resource id to another activity.
- If the bitmap comes from a users' action (captured from camera for example) then you can save the bitmap in a local file then pass the file path to another activity.
Hope this helps!
Solution 2:
if you are using custom toolbar to inflate menu then please set toolbar :-
setSupportActionBar(toolbar);
then the menu is inflated properly otherwise the problem is not this.
Post a Comment for "Startactivity(intent) Is Doing Nothing"