black screen switching between activity

早过忘川 提交于 2019-12-01 19:05:06
Ameen Maheen

This worked for me:

Intent intent = new Intent(LocationGrid.this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
overridePendingTransition(0, 0);

Your code is a bit confusing and unclear. Please specify the goal. Anyway, some things I see:

1- Do not use getApplicationContext(), an Activity is a Context itself, thus it's better to use:

new Intent (this, landingPage.class);

2- You don't need to create a Bundle to add a string to to an intent.

viewIntent.addExtra("ApplicationName", a_Bean.getApplicationName ());

Anyway, passing around your activities the application's name seems like a horrible idea to me. If you really need the application's name throughout the activities, create an Application class as the central point of your application. I really recommend you to revisit your architecture.

3- Are you sure you want to access the activity landingPage from its father? I assume that landingPage is instantiated somewhere. I find this to be a terrible approach. If I am wrong, please provide examples.

As for the rest of the code and your precise question, I can't answer it, I haven't worked with Progress dialogs, but we don't even know what the "bp" variable is and, as I said, you should try to ask again your question clarifying some points.

100rabh

I resolved above issue by removing DataLoader(i.e. methods that load data from Internet) from called class(i.e. my landingPage.class) to the caller class.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!