I want to add a Image icon to be added on top of rootView
in FragmentActivity
.
I tried doing this:
ViewGroup rootLayout = (ViewGroup) activity.findViewById(android.R.id.content);
myView = activity.getLayoutInflater().inflate(R.layout.iconimage, null);
rootLayout.addView(myView );
rootLayout.invalidate();
But realised that this only works for AppCompatActivity
, and doesn't work for FragmentActivity
. As my image cannot be seen.
How can i add Views to Classes that extends FragmentActivity
?