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"][/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"][/caption]
[caption id="attachment_1105" align="alignleft" width="300" caption="Java JRE deifiniton path in Eclipse"][/caption]
Now if mouse move about keywords String or F3 on keywords and press button in yellow field will opened String.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"][/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"][/caption]
Or type path in Java JRE definition
[caption id="attachment_1105" align="alignleft" width="300" caption="Java JRE deifiniton path in Eclipse"][/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
396LW NO topic_id
AD
Další témata ....(Topics)
How change background color of View Android sample.
MainActivity.java
main.xml
MainActivity.java
public class MainActivity extends Activity {
TextView hTextView;
TableRow hTableRow;
Button hButton, hButtonStop;
private Handler mHandler = new Handler();
private int nCounter = 0;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
hTextView = (TextView)findViewById(R.id.idTextView);
hButton = (Button)findViewById(R.id.idButton);
hButton.setOnClickListener(mButtonStartListener);
hTableRow = (TableRow)findViewById(R.id.idTableRow1);
} // end onCreate
View.OnClickListener mButtonStartListener = new OnClickListener() {
public void onClick(View v) {
hTableRow.setBackgroundColor(Color.YELLOW);
}
};
}
main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="//schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TableLayout android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/tableLayout1">
<TableRow android:id="@+id/idTableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:background="#5655AA">
<TextView
android:id="@+id/idTextView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
</TableRow>
</TableLayout>
</LinearLayout>
Sensor, getSystemService(), getSensorList(), getDefaultDisplay(), WindowManager,
Surface.ROTATION_0, onAccuracyChanged() Android sample.
Surface.ROTATION_0, onAccuracyChanged() Android sample.
public class _MotionActivity extends Activity implements SensorEventListener {
private float mSensorX;
private float mSensorY;
private Display mDisplay;
private SensorManager sm;
private PowerManager mPowerManager;
private WindowManager mWindowManager;
TextView textview;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Get an instance of the SensorManager
sm = (SensorManager) getSystemService(SENSOR_SERVICE);
if(sm.getSensorList(Sensor.TYPE_ACCELEROMETER).size()!=0){
Sensor s = sm.getSensorList(Sensor.TYPE_ACCELEROMETER).get(0);
sm.registerListener(this,s, SensorManager.SENSOR_DELAY_NORMAL);
}
// Get an instance of the PowerManager
mPowerManager = (PowerManager) getSystemService(POWER_SERVICE);
// Get an instance of the WindowManager
mWindowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
mDisplay = mWindowManager.getDefaultDisplay();
setContentView(R.layout.main);
textview = (TextView)findViewById(R.id.textView1);
}
@Override
public void onSensorChanged(SensorEvent event) {
if (event.sensor.getType() != Sensor.TYPE_ACCELEROMETER)
return;
switch (mDisplay.getRotation()) {
case Surface.ROTATION_0:
mSensorX = event.values[0];
mSensorY = event.values[1];
textview.setText(String.valueOf( mSensorX));
break;
case Surface.ROTATION_90:
mSensorX = -event.values[1];
mSensorY = event.values[0];
textview.setText(String.valueOf( mSensorX));
break;
case Surface.ROTATION_180:
mSensorX = -event.values[0];
mSensorY = -event.values[1];
textview.setText(String.valueOf( mSensorX));
break;
case Surface.ROTATION_270:
mSensorX = event.values[1];
mSensorY = -event.values[0];
textview.setText(String.valueOf( mSensorX));
break;
}
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
// TODO Auto-generated method stub
}
@Override
protected void onResume() {
super.onResume();
if(sm.getSensorList(Sensor.TYPE_ACCELEROMETER).size()!=0){
Sensor s = sm.getSensorList(Sensor.TYPE_ACCELEROMETER).get(0);
sm.registerListener(this,s, SensorManager.SENSOR_DELAY_NORMAL);
}
}
@Override
protected void onPause() {
sm.unregisterListener(this);
super.onStop();
}
}
Goto in for cycle Java example source code.
MainClass.java
MainClass.java
public class MainClass {
public static void main(String[] arg) {
String[] arrayOfString = {"nothing", "Hello", "people"
, "bye-bye", "hello", "world!", "end" };
OuterLoop: for (int i = 0;i<6; i++) {
for (int j = 0; j < arrayOfString.length; j++) {
if (arrayOfString[j].equals("world!")) {
continue OuterLoop; // as goto from Csharp, or C/C++
}
System.out.println(arrayOfString[j]);
System.out.println(i);
if (i == 1) {
System.out.println("break");
break OuterLoop;
}
}
}
}
}
/*
nothing
0
Hello
0
people
0
bye-bye
0
hello
0
nothing
1
break
*/
build.gradle in module have higher priority then AndrodiManifest.xml
Try this.
AndroidManifest.xml have code:
build.gradle have code:
Warning in AndroidManifest.xml:
Try this.
AndroidManifest.xml have code:
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="23" />
build.gradle have code:
defaultConfig {
applicationId "cz.okhelp.words"
minSdkVersion 9
targetSdkVersion 19
versionCode 107
versionName "1.0.7"
}
Warning in AndroidManifest.xml:
This targetSdkVersion value (23) is not used; it is always overridden by the value specified in the Gradle build script (19) less... (Ctrl+F1)
The value of (for example) minSdkVersion is only used if it is not specified in the build.gradle build scripts. When specified in the Gradle build scripts, the manifest value is ignored and can be misleading, so should be removed to avoid ambiguity.
Editace: 2014-02-15 20:46:40
Počet článků v kategorii: 396
Url:class-file-editor-source-not-found-change-attached-source-eclipse