У меня есть метод, который работает на эмуляторе в Android Studio, но дает сбой на физическом устройстве. Я пробовал это на двух разных устройствах.
Это не графическое изображение, поэтому оно не связано с разрешением.
Это код
public void selectLexiconForDeletion(){
// only called from Select options, not when loading
databaseAccess = DatabaseAccess.getInstance(this, LexData.getDatabasePath(), LexData.getDatabase());
ArrayList lexiconList = databaseAccess.get_lexicons();
if (!lexiconList.isEmpty()) {
ArrayList options= new ArrayList();
for (int c = 0; c < lexiconList.size(); c++) {
options.add(lexiconList.get(c).LexiconName);
}
final String[] opts;
opts = options.toArray(new String[]{});
Log.d("opts", String.valueOf(opts.length));
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Select");
builder.setItems(opts, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {
// opts[item] is the name of the lexicon
dialog.dismiss();
deleteLexiconAlert(opts[item]);
}
});
builder.show();
}
}
Это сообщение об ошибке, указывающее на строку builder.show(); В журнале видно, что записи успешно считаны из базы данных.
2025-01-08 08:03:07.401 13922-13922 AndroidRuntime com.tylerhosting.hoot
E FATAL EXCEPTION: main
Process: com.tylerhosting.hoot, PID: 13922
android.content.res.Resources$NotFoundException: Resource ID #0x0
at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:216)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2148)
at android.content.res.Resources.getLayout(Resources.java:1157)
at android.view.LayoutInflater.inflate(LayoutInflater.java:421)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at android.support.v7.app.AlertController$AlertParams.createListView(AlertController.java:989)
at android.support.v7.app.AlertController$AlertParams.apply(AlertController.java:965)
at android.support.v7.app.AlertDialog$Builder.create(AlertDialog.java:982)
at android.support.v7.app.AlertDialog$Builder.show(AlertDialog.java:1006)
at com.tylerhosting.hoot.hoot.ToolsActivity.selectLexiconForDeletion(ToolsActivity.java:670)
at com.tylerhosting.hoot.hoot.ToolsActivity$11.onClick(ToolsActivity.java:426)
at android.view.View.performClick(View.java:6892)
at android.widget.TextView.performClick(TextView.java:12693)
at android.view.View$PerformClick.run(View.java:26104)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6944)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Подробнее здесь: https://stackoverflow.com/questions/793 ... al-devices
Приложение работает на эмуляторе, но вылетает на физических устройствах ⇐ JAVA
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Приложение работает на эмуляторе, но вылетает на физических устройствах
Anonymous » » в форуме Android - 0 Ответы
- 18 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Приложение работает на эмуляторе, но вылетает на физических устройствах
Anonymous » » в форуме Android - 0 Ответы
- 16 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Приложение работает на эмуляторе, но вылетает на физических устройствах
Anonymous » » в форуме Android - 0 Ответы
- 15 Просмотры
-
Последнее сообщение Anonymous
-