我的Android应用程序在阿拉伯语系统上崩溃

时间:2016-01-03 14:15:16

标签: java android wordpress android-intent android-asynctask

我是Android开发的初学者,我的应用程序工作正常,但如果android系统语言改为阿拉伯语,它会崩溃 下面是我的日志

  

01-03 08:50:20.150:D / AndroidRuntime(1351):关闭VM 01-03   08:50:20.150:W / dalvikvm(1351):threadid = 1:线程退出   未捕获的异常(组= 0xb19feba8)01-03 08:50:20.170:   E / AndroidRuntime(1351):FATAL EXCEPTION:main 01-03 08:50:20.170:   E / AndroidRuntime(1351):进程:com.miniawy.wordpress,PID:1351   01-03 08:50:20.170:E / AndroidRuntime(1351):   java.lang.NullPointerException 01-03 08:50:20.170:   E / AndroidRuntime(1351):at   java.util.ArrayList.addAll(ArrayList.java:188)01-03 08:50:20.170:   E / AndroidRuntime(1351):at   com.miniawy.wordpress.fragment.FraMain.setAllPostsForCategory(FraMain.java:792)   01-03 08:50:20.170:E / AndroidRuntime(1351):at   com.miniawy.wordpress.fragment.FraMain.defineAndFillData(FraMain.java:440)   01-03 08:50:20.170:E / AndroidRuntime(1351):at   com.miniawy.wordpress.MainActivity.defineAndFillData(MainActivity.java:229)   01-03 08:50:20.170:E / AndroidRuntime(1351):at   com.miniawy.wordpress.wordpress.FetchRecentPostsByCategory.onPostExecute(FetchRecentPostsByCategory.java:158)   01-03 08:50:20.170:E / AndroidRuntime(1351):at   com.miniawy.wordpress.wordpress.FetchRecentPostsByCategory.onPostExecute(FetchRecentPostsByCategory.java:1)   01-03 08:50:20.170:E / AndroidRuntime(1351):at   android.os.AsyncTask.finish(AsyncTask.java:632)01-03 08:50:20.170:   E / AndroidRuntime(1351):at   android.os.AsyncTask.access $ 600(AsyncTask.java:177)01-03   08:50:20.170:E / AndroidRuntime(1351):at   android.os.AsyncTask $ InternalHandler.handleMessage(AsyncTask.java:645)   01-03 08:50:20.170:E / AndroidRuntime(1351):at   android.os.Handler.dispatchMessage(Handler.java:102)01-03   08:50:20.170:E / AndroidRuntime(1351):at   android.os.Looper.loop(Looper.java:136)01-03 08:50:20.170:   E / AndroidRuntime(1351):at   android.app.ActivityThread.main(ActivityThread.java:5001)01-03   08:50:20.170:E / AndroidRuntime(1351):at   java.lang.reflect.Method.invokeNative(Native Method)01-03   08:50:20.170:E / AndroidRuntime(1351):at   java.lang.reflect.Method.invoke(Method.java:515)01-03 08:50:20.170:   E / AndroidRuntime(1351):at   com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:785)   01-03 08:50:20.170:E / AndroidRuntime(1351):at   com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)01-03   08:50:20.170:E / AndroidRuntime(1351):at   dalvik.system.NativeStart.main(Native Method)01-03 08:55:20.690:   I /处理(1351):发送信号。 PID:1351 SIG:9

来源`/ **      *删除显示加载新闻列表的进度条      * /     public void removeNewsListLoading(){         this.mListNewsLoading.setVisibility(View.GONE);     }

/**
 * Removes the progress bar that shows loading of slider
 */
public void removeSlidingLoadingView() {
    this.mSliderLoading.setVisibility(View.GONE);
}

/**
 * Sets all post for a given category
 * 
 * @param allPostsForCategory
 *            list of all posts for a given category
 */
public void setAllPostsForCategory(ArrayList<Post> allPostsForCategory,
        boolean addMore) {
    if (!addMore) {
        this.mAllPostsForCategory.clear();
    }
    this.mAllPostsForCategory.addAll(allPostsForCategory);
}

/**
 * Marks the share dialog as opened
 * 
 * @param openedContextShareDialog
 *            layout of the share dialog
 */
public void setOpenedContextShareDialog(
        LinearLayout openedContextShareDialog) {
    if (openedContextShareDialog != null) {
        this.mOpenedContextShareDialog = openedContextShareDialog;
    }
}

/**
 * Shares a post via Facebook by given index
 * 
 * @param postIndex
 *            index of the post to be shared
 */
@Override
public void shareViaFacebook(int postIndex) {
    if (mOpenedContextShareDialog != null
            && mOpenedContextShareDialog.getVisibility() == View.VISIBLE) {
        mOpenedContextShareDialog.setVisibility(View.GONE);
    }
    if (NetworkManager.isNetworkConnected(getActivity())) {
        Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
        shareIntent.setType("text/plain");
        shareIntent.putExtra(Intent.EXTRA_SUBJECT, mListPosts.get(postIndex)
                .getTitle());
        shareIntent.putExtra(Intent.EXTRA_TEXT, mListPosts.get(postIndex)
                .getUrl());
        PackageManager pm = getActivity().getPackageManager();
        List<ResolveInfo> activityList = pm.queryIntentActivities(
                shareIntent, 0);
        boolean hasFacebookApp = false;
        for (final ResolveInfo app : activityList) {
            if ((app.activityInfo.name).contains("facebook")) {
                final ActivityInfo activity = app.activityInfo;
                final ComponentName name = new ComponentName(
                        activity.applicationInfo.packageName, activity.name);
                shareIntent.addCategory(Intent.CATEGORY_LAUNCHER);
                shareIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                        | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
                shareIntent.setComponent(name);
                startActivity(shareIntent);
                hasFacebookApp = true;
                break;
            }
        }
        if (!hasFacebookApp) {
            Toast.makeText(
                    getActivity(),
                    "There is no Facebook app installed.",
                    Toast.LENGTH_SHORT).show();
        }
    } else {
        Toast.makeText(
                getActivity(),
                getResources().getString(R.string.no_internet_connectivity),
                Toast.LENGTH_SHORT).show();
    }

}

`

0 个答案:

没有答案