rss feed时找不到Android文件错误

时间:2014-02-12 19:20:44

标签: android rss

我有一个Android应用程序。当RSS使用URL提供时强制关闭。它应该采取数据和显示。抱歉我的英语很差。

这是我的logcat:

enter image description here

这是我的活动:

public class Site2 extends FragmentActivity {
// Connection detector class
ConnectionDetector cd;
Boolean isInternetPresent = false;
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    // creating connection detector class instance
    cd = new ConnectionDetector(getApplicationContext());
    // creating connection detector class instance
            cd = new ConnectionDetector(getApplicationContext());



            // get Internet status
            isInternetPresent = cd.isConnectingToInternet();

            // check for Internet status
            if (isInternetPresent) {
                // Internet Connection is Present
                // make HTTP requests
                showAlertDialog(Site2.this, "Internet Connection",
                        "You have internet connection", true,1);
            } else {
                // Internet connection is not present
                // Ask user to connect to Internet
                showAlertDialog(Site2.this, "No Internet Connection",
                        "You don't have internet connection.", false,2);
            }

    if ((isInternetPresent) &&(savedInstanceState == null)) {
        addRssFragment();
    }


}

private void addRssFragment() {
    FragmentManager manager = getSupportFragmentManager();
    FragmentTransaction transaction = manager.beginTransaction();
    RssFragment fragment = new RssFragment();
    ////////////////////////////////////////

    Bundle bundle = new Bundle(2);
    bundle.putInt("url", 1);
    bundle.putString("url", "http://www.dz-recrutement.blogspot.com/rss.xml");
    fragment.setArguments(bundle);
    //////////////////////////////////////
    transaction.add(R.id.fragment_container, fragment);
    transaction.commit();

}

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putBoolean("fragment_added", true);
}
public void showAlertDialog(Context context, String title, String message, Boolean status,int rol) {
    AlertDialog alertDialog = new AlertDialog.Builder(context).create();

    // Setting Dialog Title
    alertDialog.setTitle(title);

    // Setting Dialog Message
    alertDialog.setMessage(message);

    // Setting alert dialog icon
    alertDialog.setIcon((status) ? R.drawable.success : R.drawable.fail);

    switch(rol){
    case 1:
        alertDialog.setButton("OK", new DialogInterface.OnClickListener() {

            public void onClick(DialogInterface dialog, int which) {

            }
        });
        break;
    case 2:
        alertDialog.setButton("OK", new DialogInterface.OnClickListener() {

            public void onClick(DialogInterface dialog, int which) {
                finish();
            }
        });
        break;
}


    // Showing Alert Message
    alertDialog.show();
}
 }

我添加了所有权限。请帮帮我。

1 个答案:

答案 0 :(得分:0)

日志文件说:“FileNotFoundException”,当我输入Url时,该文件不再存在:)。

http://www.dz-recrutement.blogspot.com/rss.xml

这个问题确定存在。