Resource Entry already defined
Check if in drawable folder have two picture with same name and delete one.
For example:
Check the module build folder in Android Studio for two files with same names.
For example:
image_1.jpg
image_1.png
Check the module build folder in Android Studio for two files with same names.
C:\Users\myFolder\AndroidStudioProjects\Project\yourModule\build\intermediates\res\merged\debug\drawable\
396LW NO topic_id
AD
Další témata ....(Topics)
public class MyClass extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
String sMyText = "some text";
int nMyInt = 10;
@Override
protected void onSaveInstanceState(Bundle outState) {
// Save away the original text, so we still have it if the activity
// needs to be killed while paused.
outState.putString("my_text", sMyText);
outState.putInt("my_int", nMyInt);
Toast.makeText(this, "onSaveInstanceState()", Toast.LENGTH_LONG).show();
Log.i("onSaveInstanceState", "onSaveInstanceState()");
}
String sNewMyText = "";
int nNewMyInt = 0;
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
// restore saved values
sNewMyText = savedInstanceState.getString("my_text");
nNewMyInt = savedInstanceState.getInt("my_int");
Toast.makeText(this, "onRestoreInstanceState()", Toast.LENGTH_LONG).show();
Log.i("onRestoreInstanceState", "onRestoreInstanceState()");
}
}
Click to Android version combobox - drop down menu and select your version, which just using (have instaled). For example: You updated ADT by SDK manager, but forget to update Android version. You can use lower version from drop down menu, which using your project, or do update of Android by SDK manager.
Issue:
ActivityThread: Failed to find provider
Try check this authority tags if they are all the same:
(com.yourdomen.yourproject.YourContentProviderClass replace your path to YourContentProviderClass)
res/xml/serchable.xml
Tag searchable
AndroidManifest.xml
Tag provider
ActivityThread: Failed to find provider
Try check this authority tags if they are all the same:
(com.yourdomen.yourproject.YourContentProviderClass replace your path to YourContentProviderClass)
res/xml/serchable.xml
Tag searchable
<searchable xmlns:android="//schemas.android.com/apk/res/android"
android:blahblah
......
android:searchSuggestAuthority="com.yourdomen.yourproject.YourContentProviderClass"
AndroidManifest.xml
Tag provider
<provider android:name=".YourContentProviderClass"
android:authorities="com.yourdomen.yourproject.YourContentProviderClass" />
Solution:
public void alertMy(String sTitle, String sMessage){
AlertDialog.Builder builder = new AlertDialog.Builder(Test.this); // activity
builder.setTitle(sTitle)
.setMessage(sMessage)
.setCancelable(false)
.setNegativeButton("Close",new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show();
}
Spinner, ArrayAdapter, setOnItemSelectedListener, onItemSelected, setDropDownViewResource
MainClass.java
strings.xml
MainClass.java
public class Vypocet extends Activity {
Spinner hSpinnerMetry;
// .......
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
hSpinnerMetry = (Spinner) findViewById(R.id.idSpinnerMetry);
ArrayAdapter<CharSequence> adapterMetry = ArrayAdapter.createFromResource(
this, R.array.metry_array, android.R.layout.simple_spinner_item);
adapterMetry.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
hSpinnerMetry.setAdapter(adapterMetry);
hSpinnerMetry.setOnItemSelectedListener(
new OnItemSelectedListener() {
public void onItemSelected(
AdapterView<?> parent, View view, int position, long id) {
int nPos = position;
}
public void onNothingSelected(AdapterView<?> parent) {
}
});
}
}
strings.xml
<string-array name="metry_array">
<item>m</item>
<item>dm</item>
<item>cm</item>
<item>mm</item>
</string-array>
Editace: 2016-03-02 19:30:07
Počet článků v kategorii: 396
Url:resource-entry-already-defined