Okhelp.cz

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.

Class File Editor - Source not found - Change Attached Source - Eclipse

The source attachment does not contain the source for the file TextWatcher.class.
You can change the source attachment by clicking Change Attached Source below:

You have to add JDK src.zip path to dialog as on image below.
[caption id="attachment_1091" align="alignleft" width="282" caption="class file editor source not found Eclipse warning"]android/class-file-editor-source-not-found-282x300.png[/caption]



Or go to Project > Properties > Java Build Path > Libraries
Expand JRE System Library. Expand rt.jar.
Select Source attachment and double click or Edit.
Type path the source code file (External File…) and press OK.

[caption id="attachment_1094" align="alignleft" width="300" caption="Java project build path"]android/java-build-path-300x175.png[/caption]



Or type path in Java JRE definition



[caption id="attachment_1105" align="alignleft" width="300" caption="Java JRE deifiniton path in Eclipse"]android/java-jre-definition-eclipse-300x216.png[/caption]

How open String.class or others keywords definition with Eclipse.



Now if mouse move about keywords String or F3 on keywords and press button in yellow field will opened String.class
android/java-eclipse-tooltip-300x212.png




android/java-lang-string-class-300x210.png

396LW NO topic_id




AD

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


100

How evaluate any expression in Eclipse debugger editor Android example | how-evaluate-any-expression-in-eclipse-debugger-editor-android-example


Tutorial by pictures how evaluate a variable in Eclipse debugger window.

1.) Open Debug perspective in Eclipse and to start debugging a Activity.
android/eclipse-debug-perspective.png


2.) Open Display window from menu Window->Show view->Display

android/eclipse-show-view-display.png

3.) Set breakpoint where you need to evaluate a variable.

android/eclipse-toggle-breakpoint.png

4.) Debug the Activity to breakpoint.

android/eclipse-debugger-breakpoint.png


5.) Into the Display window type code for evaluate your variable and execute code.

android/eclipse-type-evaluate-code-to-display-window.png


6.) Check if change of value a variable

android/eclipse-evaluate-a-variable.png

50

How get package resource apk path on device Android example | how-get-package-resource-path-android-example


On Android device is path to *.apk like this example:
/data/app/cz.okhelp.my_package.apk


How get package *.apk path on device dynamically Android example

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        String sPackagePath = getPackageResourcePath();
     }
27

Get Context Java Android example | get-context-java-android-example


getContext() getApplicationContext() method Java Android example source






Context myContext_1 = ThisClassName.this; // to open a Dialog
Context myContext_2 = getContext();
Context myContext_3 = this.getContext();
Context myContext_4 = this;
Context myContext_5 = this.getApplicationContext ();


OnClickListener getImageBtnOnClick = new OnClickListener() {
public void onClick(View view) {
Context context = view.getContext();

}
};
// Toast
Toast.makeText(getApplicationContext(), "Context == getApplicationContext "
, Toast.LENGTH_SHORT).show();



// store Context in public class
public class MyActivity extends Activity {
public static Context myCnt = null;
...
protected void onCreate(Bundle icicle) {
...
myCnt = this;
MyStorage.setContext(myCnt);
// or
// MyStorage.setContext(this);

// cntxFromStorage == this
Context cntxFromStorage = MyStorage.getContext();
...
};
};

public class MyStorage
{
private static Context cntStorageContext = null;


public static Context getContext() {
return cntStorageContext;
}

public static void setContext(Context context) {
MyStorage.cntStorageContext = context;
}


};

class DataBaseHelper extends SQLiteOpenHelper {
// get MyActivity context
Context cnt = MyStorage.getContext();

}



35

Android startup tutorial for developers video | android-startup-tutorial-for-developers-video


How install Android emulator on PC
//developer.android.com/sdk/installing.html

Download links:
Java Development Kit JDK download
Eclipse download
Android SDK download