Monthly Archives: May 2013

Install Team-viewer in Ubuntu

open Terminal. When it opens, run the command below to download Team Viewer deb package.

If you have 32-bit version of Ubuntu, run the commands below to download that version:

wget http://www.teamviewer.com/download/teamviewer_linux.deb

After downloading, run the commands below to install it.

sudo dpkg -i teamviewer_linux.deb

If you have 64-bit version of Ubuntu,run the commands below to download that version:


wget http://www.teamviewer.com/download/teamviewer_linux_x64.deb

Then run the commands below to install:

sudo dpkg -i teamviewer_linux_x64.deb

if u Want to Run Team Viewer than type below command on terminal

teamviewer

Show or Hide soft keyboard on opening a dialog or activity in android

For showing the soft keyboard on entering into the activity or to the dialog we can use this coding

Add the following code just before alert.show()

InputMethodManager input = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
input.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);

for hiding keyboard
InputMethodManager input = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
input.hideSoftInputFromWindow(singleedittext.getWindowToken(),0);

Show soft keyboard automatically when Edit Text receives focus in Android

   editText.setOnFocusChangeListener(new OnFocusChangeListener() {

            @Override
            public void onFocusChange(View v, boolean hasFocus) {
                editText.post(new Runnable() {
                    @Override
                    public void run() {
                        InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
                        imm.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT);
                    }
                });
            }
        });
        editText.requestFocus();

Restore ListView Previous State in Android

// save index and top position
int index = mylistview.getFirstVisiblePosition();
View v = mylistview.getChildAt(0);
int top = (v == null) ? 0 : v.getTop();
......
// restore
mylistview.setSelectionFromTop(index, top);

or


// Save ListView state
Parcelable state = listView.onSaveInstanceState();

// Set new items
listView.setAdapter(adapter);

// Restore previous state (including selected item index and scroll position)
listView.onRestoreInstanceState(state);
 
%d bloggers like this: