我在Android应用上遇到了奇怪的错误。我找不到有关此错误的任何有用信息来源:
java.lang.NullPointerException
at org.uusoftware.burclar.a.a$1$1.onClick(Unknown Source)
at android.support.v7.a.d$a$3.onItemClick(Unknown Source)
at android.widget.AdapterView.performItemClick(AdapterView.java:308)
at android.widget.AbsListView.performItemClick(AbsListView.java:1509)
at android.widget.AbsListView$PerformClick.run(AbsListView.java:3467)
at android.widget.AbsListView$3.run(AbsListView.java:4830)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5602)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
我无法检测到哪里出现此错误,哪个代码块在应用中都没有出现此错误。感谢。
另外:这是我在Github上的项目:https://github.com/aykutuludag/GunlukBurclar
增加2:这是我在Google Play上的应用:https://play.google.com/store/apps/details?id=org.uusoftware.burclar
补充3:我怀疑应用程序在这些代码块上崩溃,但我不知道它崩溃的原因:
View.OnClickListener clickListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
ViewHolder holder = (ViewHolder) view.getTag();
final int position = holder.getPosition();
AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
builder.setTitle(R.string.chooseaction);
builder.setItems(R.array.choose_actions, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// Get Uri
String path = Environment.getExternalStorageDirectory().toString() + "/Günlük Burçlar";
File f = new File(path);
File file[] = f.listFiles();
Intent intent = new Intent();
if (which == 0) {
// Show
intent.setAction(android.content.Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(file[position]), "image/*");
mContext.startActivity(intent);
} else if (which == 1) {
// Share
intent.setAction(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file[position]));
intent.setType("image/*");
mContext.startActivity(intent);
} else {
// Delete
file[position].delete();
Toast.makeText(mContext, R.string.deleted, Toast.LENGTH_SHORT).show();
intent = new Intent(mContext, FavoritesActivity.class);
mContext.startActivity(intent);
((FavoritesActivity) mContext).finish();
}
}
});
builder.show();
}
};
答案 0 :(得分:1)
我终于找到了错误。不幸的是,崩溃的原因是土耳其人。
<强>错误强>
String path = Environment.getExternalStorageDirectory().toString() + "/Günlük Burçlar";
<强>真强>
String path = Environment.getExternalStorageDirectory().toString() + "/Günlük Burçlar";