How activity interacts with the window, when on-screen soft keyboard is shown.

  • The state of the soft keyboard whether it is hidden or visible, when the activity becomes the focus of the user attention.
  • The adjustment made to the activity's main window whether it is re-sized smaller to make room for the soft keyboard or whether its contents pan to make the current focus visible when part of the window is covered by the soft keyboard.

How to get screen width and height of the phone

DisplayMetrics mdmetrics = new DisplayMetrics();

int height = mdmetrics.heightPixels;
int weight = mdmetrics.widthPixels;

Get screen width and height -- android

Snippets on the application asset folder.

Get absolute path of applications [root] data folder path
File iFile = Environment.getDataDirectory();
Log.i("Data folder"," --- " + iFile.getAbsolutePath() + " --- " );
Get package name of the current activity.

Log.i("Activity Package Name"," --- " + this.getPackageName()+" --- " );

Get the path of "files" folder from application assets.
Log.i("Path of files folder path inside assets "," --- " + mContext.getFilesDir().getPath() + " --- ");
Read all file names inside the application assets folder.
AssetManager mngr = getResources().getAssets();
String[] assets = mngr.list("imgs");
for (int i = 0; i < assets.length; i++) {
Log.i("Files in imgs folder ", " --- " + assets[i] + " --- ");
Read asset file as inputstream. Convert Inputstream of image into bitmap.

InputStream is = mContext.getAssets().open("imgs/" + assets[i]);
Bitmap bm = BitmapFactory.decodeStream(is);

How to fix Android Activity Orientation to portrait or landscape

This is the way we can fix the activity orientations.
we can give this in manifest.xml or through code in oncreate method.

In manifest.xml just add this to the activity attribute tag for portrait add this

for landscape add this

This can be set using code also if you add this line in oncreate() method the activity will set to the screenorientation.
for activity orientation in Landscape add this
similar for portrait
But you must add these line in OnCreate() and before setContentView().