I want to get current activity from activity stack and replace with ??????
dialog =new AlertDialog.Builder(??????,android.R.style.Theme_Material_Dialog_Alert).setTitle("Tittle").setMessage("Message");`
How Can I Do it?
Update1 :
I can't use getContext()
or getActivty
because they return null
Also I find this
ActivityManager am =(ActivityManager)context.getSystemService(Context.ACTIVITY_SERVICE);
ComponentName cn = am.getRunningTasks(1).get(0).topActivity;
I dont know how to use cn
to conver to a context
or Activity
?
Please help me!!!