I am trying to reload my MainActivity from the adapter. Please find the code below:
activity = (Activity) context;
activity.finish();
activity.overridePendingTransition(0, 0);
Intent intent =((Activity) context).getIntent();
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
context.startActivity(intent);
activity.overridePendingTransition(0, 0);
The issue is, even after adding this code block, the flashing animation is still appearing during the reloading of the activity.
Inside the adapter, I am showing one dialog. On pressing a button, the dialog results in reloading of the activity.
Inside onBindViewHolder():
viewHolder.txtv_name.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v)
{
int_timer = 0;
tickValue = true;
timerGroupChatHistory.start();
getChatHistory(alst_Dealitem.get(i));
}
});
Inside Chat History, I am calling ShowChatDialog():
public void show_chatDialog(final ArrayList<chatObject> alst_chatHistoryList, final String refNumber)
{
final Dialog dlg_dialog = new Dialog(context, R.style.Theme_Dialog);
// dialog.setCancelable(false);
dlg_dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
Window window = dlg_dialog.getWindow();
if (window == null) return;
WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
lp.copyFrom(dlg_dialog.getWindow().getAttributes());
lp.width = WindowManager.LayoutParams.FILL_PARENT;
lp.height = WindowManager.LayoutParams.MATCH_PARENT;
lp.gravity = Gravity.CENTER;
dlg_dialog.getWindow().setAttributes(lp);
//dialog.setContentView(R.layout.new_field_quote_entry_dialog);
dlg_dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
dlg_dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
//dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
dlg_dialog.setContentView(R.layout.chat_history_dialog);
final RecyclerView rvw_chatHistoryList = (RecyclerView)dlg_dialog.findViewById(R.id.chatHistoryList);
final EditText etxt_chatText = (EditText)dlg_dialog.findViewById(R.id.chat_type);
final LinearLayout lnrl_mainLayout = (LinearLayout)dlg_dialog.findViewById(R.id.dialog_main_layout);
TextView txtv_send = (TextView) dlg_dialog.findViewById(R.id.chat_send);
TextView txtv_title = (TextView)dlg_dialog.findViewById(R.id.chat_text) ;
LinearLayout lnrl_back = (LinearLayout) dlg_dialog.findViewById(R.id.chat_backbutton) ;
txtv_title.setText(refNumber);
lnrl_back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
activity.finish();
activity.overridePendingTransition(0, 0);
Intent intent =((Activity) context).getIntent();
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
context.startActivity(intent);
activity.overridePendingTransition(0, 0);
}
});
Is there anything I am missing? please help. Thanks in advance.