Recepty, články, nápady, programování. Dříve dum-zahrada, finance, internet a know-how.okhelp.cz Pro lepší výsledky hledání používejte i diakritiku.

Show keyboard


Show keyboard Android phone apps development example source code.

// ActivityClass.java
InputMethodManager showSoftInput;
Button hBtnKeyboardShow ;
showSoftInput = (InputMethodManager)this.getSystemService(Context.INPUT_METHOD_SERVICE);

hBtnKeyboardShow = (Button)findViewById(R.id.btnKeyboardShow);
// END onCreate

//button listener
private OnClickListener myButtonListener = new OnClickListener() {
     public void onClick(View v) {
     	 try {
                 showSoftInput.toggleSoftInput(showSoftInput.SHOW_FORCED, 0);	
		} catch (Exception e) {
			Log.e("Keyboard show ", e.getMessage());

397LW NO topic_id


Další témata ....(Topics)


Screen Android Landscape Portrait programmatically | screen-android

Screen Android example source code for developers.
Get orientation of screen.

 public int getScreenOrientation() {
  if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT)                {
       return 1; // Portrait Mode
  }else if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
       return 2;   // Landscape mode
  return 0;

R.java not generated - Android project in Eclipse issue | r-java-not-generating-android-project-in-eclipse-issue

If You create new xml file with prefix _ , for example _style.xml and You to clean project (Project->Clean), than package in folder project\gen will deleted with R.java class and new R.java not be created.

For to solving this problem You have to rename file without prefix _ as style.xml or name what You need and rebuild project.

If some ID cannot be resolved or is not a field get error occurence
You have to delete import android.R; in Activity.class if was inserted,
when this error is displayed.

Conversion to Dalvik format failed with error 1 | conversion-to-dalvik-format-failed-with-error-1

java.lang.IllegalArgumentException: already added: Lcz/okhelp/MyMathClass;

First try this solution!!!!!
Select your project in project tree and go to the Eclipse menu Project » Clean » Clean projects selected below » select your project and click OK.

If you create *.apk package with proguard sometimes you must back up the project, delete project, and create new project if you are unable to create *.apk file.

Check your AndroidManifest.xml if all Activity is correctly inserted. If you add a library project to Main project you have to insert Activity from library to Main project AndroidManifest.xml

Problem with the library.
I deleted library project from project tree and again put the _library project into the main project. This problem was resolved.
1.)Go to Project » Properties » Java Build Path » Libraries and remove (your projects) click OK.
2.)Go to Project » Clean » Clean projects selected below » select your project and click OK.
3.)Add again your LIBRARY project to your MAIN project Project » Properties » Java Build Path » Libraries.
See image below.

Problem with a *.apk file
If you create signed *.apk, you have to delete previous *.apk from your PC folder.



How get bitmap dimension without loading Android example | how-get-bitmap-dimension-without-loading-android-example

Bitmap Width, Height without memory allocation:

BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeResource(getResources(), R.id.myimage, options);
// now opts.outWidth and opts.outHeight are the dimension of the
// bitmap, even though Bitmap is null
int imageHeight = options.outHeight;
int imageWidth = options.outWidth;
String imageType = options.outMimeType;

Essential Eclipse Shortcuts with pictures | essential-eclipse-shortcuts-with-pictures

Eclipse Navigation Shortcuts.

Ctrl+1 Quick fix problem

Ctrl+O Quick Outline

Ctrl+Shift+G Find references in workspace
Ctrl+Shift+U Find all references in file

Ctrl+Shift+T Find Java Typ

[caption id="attachment_1214" align="alignleft" width="150" caption="eclipse-ctrl-shift-t"][/caption]

Ctrl+Shift+R Find Resource

Ctrl+E Open Editor Drop-Down
Ctrl+Space Content Assist

Ctrl+Shift+Space Context Information


F3 Open Declaration of variable
F4 Open Type Hierarchy
Ctrl+H Open Search Dialog
Alt+Shift+R Rename - Refactoring
Alt+Shift+M Extract Method
Alt+Shift+L Extract Local Variable

Alt Shift Up Expand selection to enclosing element
Alt Shift Right Expand selection to next element
Alt Shift Left Expand selection to previous element
Alt Shift Down Restore previous selection

Breakpoints Shift+Alt+Q B
Cheat Sheets Shift+Alt+Q H
Console Shift+Alt+Q C
Java Declaration Shift+Alt+Q D
Java Package Explorer Shift+Alt+Q P
Java Type Hierarchy Shift+Alt+Q T
Javadoc Shift+Alt+Q J
Search Shift+Alt+Q S
Show View (View: Outline)Shift+Alt+Q O
Show View (View: Problems)Shift+Alt+Q X
Synchronize Shift+Alt+Q Y
Variables Shift+Alt+Q V

Editace: 2011-09-26 20:52:31
Počet článků v kategorii: 397

11 Share