Android OnClick侦听器似乎不起作用

时间:2013-09-20 14:57:39

标签: java android layout onclick onclicklistener

我已经构建了一个应用程序,它应该使用HttpURLConnection从Web下载数据。我使用了这里的教程/示例:

http://dev-androidapps.blogspot.com/2013/09/web-download.html

正如StackOverflow成员所建议的那样,我正在使用JSoup提取HTML数据:

Issue Extracting HTML Data Via Android

我的问题是 - 我已经按照教程进行编译,所有内容都没有错误 - 但是当我尝试运行应用程序时 - 在我输入网址后我想从中提取数据 - 该应用说它已保存数据到SD卡 - 但每次我浏览到该文件夹​​ - 它都是空的。

来源:

主要活动:

    public class MainActivity extends Activity {

    private ListView lv;
    private ArrayList<String> urlist;
    private ArrayAdapter<String> aa;
    private String storeDir;
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        urlist=new ArrayList<String>();
        aa=new ArrayAdapter<String>(this,R.layout.listlayout,urlist);
        lv=(ListView)findViewById(R.id.url_list);
        lv.setAdapter(aa);
        Intent intent=getIntent();
        String action=intent.getAction();       
        if(Intent.ACTION_VIEW.equals(action)){         
          Uri uri=intent.getData();
          EditText txturl=(EditText)findViewById(R.id.txt_input);
          txturl.setText(uri.toString());

        }


    }

    protected void onStart(){
     super.onStart();
     createStoreDir();
    }

    protected void onResume(){
     super.onResume();
     registerReceiver(receiver, new IntentFilter("com.example.webdownloader"));     
    }

    protected void onPause(){
     super.onPause();
     unregisterReceiver(receiver);


    }

    private BroadcastReceiver receiver=new BroadcastReceiver(){
     public void onReceive(Context context,Intent intent){

            Bundle b=intent.getExtras();
            if(b!=null){
             TextView tv=(TextView)findViewById(R.id.txt_view);
             tv.setText(b.getString("BACKMESS"));
            }
     }
    };


    public void createStoreDir(){
     storeDir=Environment.getExternalStorageDirectory()+"/webdownload";
     File f=new File(storeDir);
     if(!f.exists())
         if(!f.mkdir()){
           Log.e("Error","Can't create webdownload directory");
           disableButtons();
        }
    }

    public void disableButtons(){
     Button btadd=(Button)findViewById(R.id.bt_add);
     Button btok=(Button)findViewById(R.id.bt_ok);
     btadd.setEnabled(false);
     btok.setEnabled(false);
    }
//    public boolean onCreateOptionsMenu(Menu menu) {
//        // Inflate the menu; this adds items to the action bar if it is present.
//        getMenuInflater().inflate(R.menu.main, menu);
//        return true;
//    }

    public void addClick(View view){
     EditText txturl=(EditText)findViewById(R.id.txt_input);
     String url=txturl.getText().toString();
     if(url.length()>0){
      urlist.add(url);
      aa.notifyDataSetChanged();
     }
    }
    public void okClick(View view){
     TextView tv=(TextView)findViewById(R.id.txt_view);
     tv.setText("Please wait...");
     Intent newIntent=new Intent(this,DownloadService.class);
     newIntent.putStringArrayListExtra("URLS", urlist);
     newIntent.putExtra("OUTDIR",storeDir);     
     startService(newIntent);

    }

}

下载服务:

public class DownloadService extends IntentService {
 private ArrayList<String> urlist;
 private String storeDir;
 public DownloadService() {
  super("SERVICE");
  // TODO Auto-generated constructor stub
 }

 public void onHandleIntent(Intent intent){
  Bundle b=intent.getExtras();  
  if(b!=null){
   urlist=b.getStringArrayList("URLS");
   storeDir=b.getString("OUTDIR");
   startDownload();
  }


 }

 public void startDownload(){
  String feedback="";
  if(urlist.size()>0){
  try {
   for(int i=0;i<urlist.size();i++){        

    URL url=new URL(urlist.get(i));
    readDataStream(url); 

   }

   feedback="Complete! Check the webdownload directory on your sdcard";

   } catch (MalformedURLException e) { e.printStackTrace();}
  }
  else{

   feedback="No url is added to the download list.";
  }
  //send feedback message to the main activity
  Intent backIntent=new Intent("com.example.webdownloader");
  backIntent.putExtra("BACKMESS", feedback);  
  sendBroadcast(backIntent);

 }
 public void readDataStream(URL url){
     try {

      File f=new File(storeDir);
      if(f.exists()){
       HttpURLConnection con=(HttpURLConnection)url.openConnection();
       InputStream is=con.getInputStream();
       String path=url.getPath();
       String filename=path.substring(path.lastIndexOf('/')+1);   
       FileOutputStream fos=new FileOutputStream(storeDir+"/"+filename);
       int data=0;
       while((data=is.read())!=-1){
        fos.write(data);
       }
       is.close();
       fos.flush();
       fos.close();
      }
      else
       Log.e("Error","Not found "+storeDir);

  } catch (IOException e) {
   e.printStackTrace();
  }

    }
}

ACTIVITY MAIN XML:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity"
android:orientation="vertical"

>

<EditText
android:id="@+id/txt_input"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:hint="@string/txt_hint"
/> 
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" 
android:orientation="horizontal"
>
<Button
android:id="@+id/bt_add"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/bt_label" 
android:onClick="addClick"
/>
<Button
android:id="@+id/bt_ok"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/bt_ok" 
android:onClick="okClick"
/>
</LinearLayout>
<TextView 
android:id="@+id/txt_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<ListView
android:id="@+id/url_list"
android:layout_width="fill_parent"
android:layout_height="300dp"
android:paddingBottom="20dp"
android:paddingTop="20dp"
android:background="#f8f8f8" 
/> 

</LinearLayout>

logcat的:

09-20 11:13:27.856: E/SpannableStringBuilder(29261): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
09-20 11:13:27.866: E/SpannableStringBuilder(29261): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
09-20 11:13:29.368: W/InputEventReceiver(29261): Attempted to finish an input event but the input event receiver has already been disposed.
09-20 11:13:29.368: W/InputEventReceiver(29261): Attempted to finish an input event but the input event receiver has already been disposed.
09-20 11:13:33.562: W/System.err(29261): java.net.MalformedURLException: Protocol not found: www.google.com
09-20 11:13:33.562: W/System.err(29261):    at java.net.URL.<init>(URL.java:178)
09-20 11:13:33.562: W/System.err(29261):    at java.net.URL.<init>(URL.java:127)
09-20 11:13:33.562: W/System.err(29261):    at com.example.webdownloader.DownloadService.startDownload(DownloadService.java:40)
09-20 11:13:33.562: W/System.err(29261):    at com.example.webdownloader.DownloadService.onHandleIntent(DownloadService.java:28)
09-20 11:13:33.562: W/System.err(29261):    at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
09-20 11:13:33.562: W/System.err(29261):    at android.os.Handler.dispatchMessage(Handler.java:99)
09-20 11:13:33.562: W/System.err(29261):    at android.os.Looper.loop(Looper.java:137)
09-20 11:13:33.562: W/System.err(29261):    at android.os.HandlerThread.run(HandlerThread.java:60)
09-20 11:13:37.196: W/System.err(29261): java.net.MalformedURLException: Protocol not found: www.google.com
09-20 11:13:37.196: W/System.err(29261):    at java.net.URL.<init>(URL.java:178)
09-20 11:13:37.196: W/System.err(29261):    at java.net.URL.<init>(URL.java:127)
09-20 11:13:37.196: W/System.err(29261):    at com.example.webdownloader.DownloadService.startDownload(DownloadService.java:40)
09-20 11:13:37.196: W/System.err(29261):    at com.example.webdownloader.DownloadService.onHandleIntent(DownloadService.java:28)
09-20 11:13:37.196: W/System.err(29261):    at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
09-20 11:13:37.196: W/System.err(29261):    at android.os.Handler.dispatchMessage(Handler.java:99)
09-20 11:13:37.196: W/System.err(29261):    at android.os.Looper.loop(Looper.java:137)
09-20 11:13:37.196: W/System.err(29261):    at android.os.HandlerThread.run(HandlerThread.java:60)
09-20 11:13:39.719: W/System.err(29261): java.net.MalformedURLException: Protocol not found: www.google.com
09-20 11:13:39.719: W/System.err(29261):    at java.net.URL.<init>(URL.java:178)
09-20 11:13:39.719: W/System.err(29261):    at java.net.URL.<init>(URL.java:127)
09-20 11:13:39.719: W/System.err(29261):    at com.example.webdownloader.DownloadService.startDownload(DownloadService.java:40)
09-20 11:13:39.719: W/System.err(29261):    at com.example.webdownloader.DownloadService.onHandleIntent(DownloadService.java:28)
09-20 11:13:39.719: W/System.err(29261):    at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
09-20 11:13:39.719: W/System.err(29261):    at android.os.Handler.dispatchMessage(Handler.java:99)
09-20 11:13:39.719: W/System.err(29261):    at android.os.Looper.loop(Looper.java:137)
09-20 11:13:39.719: W/System.err(29261):    at android.os.HandlerThread.run(HandlerThread.java:60)
09-20 11:13:40.970: E/SpannableStringBuilder(29261): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
09-20 11:13:40.970: E/SpannableStringBuilder(29261): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
09-20 11:13:42.192: W/InputEventReceiver(29261): Attempted to finish an input event but the input event receiver has already been disposed.
09-20 11:13:44.875: W/System.err(29261): java.net.MalformedURLException: Protocol not found: www.google.com
09-20 11:13:44.875: W/System.err(29261):    at java.net.URL.<init>(URL.java:178)
09-20 11:13:44.875: W/System.err(29261):    at java.net.URL.<init>(URL.java:127)
09-20 11:13:44.875: W/System.err(29261):    at com.example.webdownloader.DownloadService.startDownload(DownloadService.java:40)
09-20 11:13:44.875: W/System.err(29261):    at com.example.webdownloader.DownloadService.onHandleIntent(DownloadService.java:28)
09-20 11:13:44.875: W/System.err(29261):    at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
09-20 11:13:44.875: W/System.err(29261):    at android.os.Handler.dispatchMessage(Handler.java:99)
09-20 11:13:44.875: W/System.err(29261):    at android.os.Looper.loop(Looper.java:137)
09-20 11:13:44.875: W/System.err(29261):    at android.os.HandlerThread.run(HandlerThread.java:60)
09-20 11:13:45.495: W/System.err(29261): java.net.MalformedURLException: Protocol not found: www.google.com
09-20 11:13:45.495: W/System.err(29261):    at java.net.URL.<init>(URL.java:178)
09-20 11:13:45.495: W/System.err(29261):    at java.net.URL.<init>(URL.java:127)
09-20 11:13:45.495: W/System.err(29261):    at com.example.webdownloader.DownloadService.startDownload(DownloadService.java:40)
09-20 11:13:45.495: W/System.err(29261):    at com.example.webdownloader.DownloadService.onHandleIntent(DownloadService.java:28)
09-20 11:13:45.495: W/System.err(29261):    at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
09-20 11:13:45.495: W/System.err(29261):    at android.os.Handler.dispatchMessage(Handler.java:99)
09-20 11:13:45.495: W/System.err(29261):    at android.os.Looper.loop(Looper.java:137)
09-20 11:13:45.495: W/System.err(29261):    at android.os.HandlerThread.run(HandlerThread.java:60)
09-20 11:13:45.786: W/System.err(29261): java.net.MalformedURLException: Protocol not found: www.google.com
09-20 11:13:45.786: W/System.err(29261):    at java.net.URL.<init>(URL.java:178)
09-20 11:13:45.786: W/System.err(29261):    at java.net.URL.<init>(URL.java:127)
09-20 11:13:45.786: W/System.err(29261):    at com.example.webdownloader.DownloadService.startDownload(DownloadService.java:40)
09-20 11:13:45.796: W/System.err(29261):    at com.example.webdownloader.DownloadService.onHandleIntent(DownloadService.java:28)
09-20 11:13:45.796: W/System.err(29261):    at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
09-20 11:13:45.796: W/System.err(29261):    at android.os.Handler.dispatchMessage(Handler.java:99)
09-20 11:13:45.796: W/System.err(29261):    at android.os.Looper.loop(Looper.java:137)
09-20 11:13:45.796: W/System.err(29261):    at android.os.HandlerThread.run(HandlerThread.java:60)
09-20 11:13:45.996: W/System.err(29261): java.net.MalformedURLException: Protocol not found: www.google.com
09-20 11:13:45.996: W/System.err(29261):    at java.net.URL.<init>(URL.java:178)
09-20 11:13:45.996: W/System.err(29261):    at java.net.URL.<init>(URL.java:127)
09-20 11:13:45.996: W/System.err(29261):    at com.example.webdownloader.DownloadService.startDownload(DownloadService.java:40)
09-20 11:13:45.996: W/System.err(29261):    at com.example.webdownloader.DownloadService.onHandleIntent(DownloadService.java:28)
09-20 11:13:45.996: W/System.err(29261):    at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
09-20 11:13:45.996: W/System.err(29261):    at android.os.Handler.dispatchMessage(Handler.java:99)
09-20 11:13:45.996: W/System.err(29261):    at android.os.Looper.loop(Looper.java:137)
09-20 11:13:45.996: W/System.err(29261):    at android.os.HandlerThread.run(HandlerThread.java:60)
09-20 11:13:47.337: W/System.err(29261): java.net.MalformedURLException: Protocol not found: www.google.com
09-20 11:13:47.337: W/System.err(29261):    at java.net.URL.<init>(URL.java:178)
09-20 11:13:47.337: W/System.err(29261):    at java.net.URL.<init>(URL.java:127)
09-20 11:13:47.337: W/System.err(29261):    at com.example.webdownloader.DownloadService.startDownload(DownloadService.java:40)
09-20 11:13:47.337: W/System.err(29261):    at com.example.webdownloader.DownloadService.onHandleIntent(DownloadService.java:28)
09-20 11:13:47.337: W/System.err(29261):    at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
09-20 11:13:47.337: W/System.err(29261):    at android.os.Handler.dispatchMessage(Handler.java:99)
09-20 11:13:47.337: W/System.err(29261):    at android.os.Looper.loop(Looper.java:137)
09-20 11:13:47.337: W/System.err(29261):    at android.os.HandlerThread.run(HandlerThread.java:60)
09-20 11:13:47.888: W/System.err(29261): java.net.MalformedURLException: Protocol not found: www.google.com
09-20 11:13:47.888: W/System.err(29261):    at java.net.URL.<init>(URL.java:178)
09-20 11:13:47.888: W/System.err(29261):    at java.net.URL.<init>(URL.java:127)
09-20 11:13:47.888: W/System.err(29261):    at com.example.webdownloader.DownloadService.startDownload(DownloadService.java:40)
09-20 11:13:47.888: W/System.err(29261):    at com.example.webdownloader.DownloadService.onHandleIntent(DownloadService.java:28)
09-20 11:13:47.888: W/System.err(29261):    at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
09-20 11:13:47.888: W/System.err(29261):    at android.os.Handler.dispatchMessage(Handler.java:99)
09-20 11:13:47.888: W/System.err(29261):    at android.os.Looper.loop(Looper.java:137)
09-20 11:13:47.888: W/System.err(29261):    at android.os.HandlerThread.run(HandlerThread.java:60)
09-20 11:13:48.468: W/System.err(29261): java.net.MalformedURLException: Protocol not found: www.google.com
09-20 11:13:48.468: W/System.err(29261):    at java.net.URL.<init>(URL.java:178)
09-20 11:13:48.468: W/System.err(29261):    at java.net.URL.<init>(URL.java:127)
09-20 11:13:48.468: W/System.err(29261):    at com.example.webdownloader.DownloadService.startDownload(DownloadService.java:40)
09-20 11:13:48.468: W/System.err(29261):    at com.example.webdownloader.DownloadService.onHandleIntent(DownloadService.java:28)
09-20 11:13:48.468: W/System.err(29261):    at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
09-20 11:13:48.468: W/System.err(29261):    at android.os.Handler.dispatchMessage(Handler.java:99)
09-20 11:13:48.468: W/System.err(29261):    at android.os.Looper.loop(Looper.java:137)
09-20 11:13:48.468: W/System.err(29261):    at android.os.HandlerThread.run(HandlerThread.java:60)
09-20 11:13:49.019: W/System.err(29261): java.net.MalformedURLException: Protocol not found: www.google.com
09-20 11:13:49.019: W/System.err(29261):    at java.net.URL.<init>(URL.java:178)
09-20 11:13:49.019: W/System.err(29261):    at java.net.URL.<init>(URL.java:127)
09-20 11:13:49.019: W/System.err(29261):    at com.example.webdownloader.DownloadService.startDownload(DownloadService.java:40)
09-20 11:13:49.019: W/System.err(29261):    at com.example.webdownloader.DownloadService.onHandleIntent(DownloadService.java:28)
09-20 11:13:49.019: W/System.err(29261):    at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
09-20 11:13:49.019: W/System.err(29261):    at android.os.Handler.dispatchMessage(Handler.java:99)
09-20 11:13:49.019: W/System.err(29261):    at android.os.Looper.loop(Looper.java:137)
09-20 11:13:49.019: W/System.err(29261):    at android.os.HandlerThread.run(HandlerThread.java:60)
09-20 11:13:49.540: W/System.err(29261): java.net.MalformedURLException: Protocol not found: www.google.com
09-20 11:13:49.540: W/System.err(29261):    at java.net.URL.<init>(URL.java:178)
09-20 11:13:49.540: W/System.err(29261):    at java.net.URL.<init>(URL.java:127)
09-20 11:13:49.540: W/System.err(29261):    at com.example.webdownloader.DownloadService.startDownload(DownloadService.java:40)
09-20 11:13:49.540: W/System.err(29261):    at com.example.webdownloader.DownloadService.onHandleIntent(DownloadService.java:28)
09-20 11:13:49.540: W/System.err(29261):    at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
09-20 11:13:49.540: W/System.err(29261):    at android.os.Handler.dispatchMessage(Handler.java:99)
09-20 11:13:49.540: W/System.err(29261):    at android.os.Looper.loop(Looper.java:137)
09-20 11:13:49.540: W/System.err(29261):    at android.os.HandlerThread.run(HandlerThread.java:60)
09-20 11:13:49.970: W/System.err(29261): java.net.MalformedURLException: Protocol not found: www.google.com
09-20 11:13:49.970: W/System.err(29261):    at java.net.URL.<init>(URL.java:178)
09-20 11:13:49.970: W/System.err(29261):    at java.net.URL.<init>(URL.java:127)
09-20 11:13:49.970: W/System.err(29261):    at com.example.webdownloader.DownloadService.startDownload(DownloadService.java:40)
09-20 11:13:49.970: W/System.err(29261):    at com.example.webdownloader.DownloadService.onHandleIntent(DownloadService.java:28)
09-20 11:13:49.980: W/System.err(29261):    at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
09-20 11:13:49.980: W/System.err(29261):    at android.os.Handler.dispatchMessage(Handler.java:99)
09-20 11:13:49.980: W/System.err(29261):    at android.os.Looper.loop(Looper.java:137)
09-20 11:13:49.980: W/System.err(29261):    at android.os.HandlerThread.run(HandlerThread.java:60)
09-20 11:13:50.170: W/System.err(29261): java.net.MalformedURLException: Protocol not found: www.google.com
09-20 11:13:50.170: W/System.err(29261):    at java.net.URL.<init>(URL.java:178)
09-20 11:13:50.170: W/System.err(29261):    at java.net.URL.<init>(URL.java:127)
09-20 11:13:50.170: W/System.err(29261):    at com.example.webdownloader.DownloadService.startDownload(DownloadService.java:40)
09-20 11:13:50.170: W/System.err(29261):    at com.example.webdownloader.DownloadService.onHandleIntent(DownloadService.java:28)
09-20 11:13:50.170: W/System.err(29261):    at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
09-20 11:13:50.170: W/System.err(29261):    at android.os.Handler.dispatchMessage(Handler.java:99)
09-20 11:13:50.170: W/System.err(29261):    at android.os.Looper.loop(Looper.java:137)
09-20 11:13:50.170: W/System.err(29261):    at android.os.HandlerThread.run(HandlerThread.java:60)
09-20 11:13:50.380: W/System.err(29261): java.net.MalformedURLException: Protocol not found: www.google.com
09-20 11:13:50.380: W/System.err(29261):    at java.net.URL.<init>(URL.java:178)
09-20 11:13:50.380: W/System.err(29261):    at java.net.URL.<init>(URL.java:127)
09-20 11:13:50.380: W/System.err(29261):    at com.example.webdownloader.DownloadService.startDownload(DownloadService.java:40)
09-20 11:13:50.380: W/System.err(29261):    at com.example.webdownloader.DownloadService.onHandleIntent(DownloadService.java:28)
09-20 11:13:50.380: W/System.err(29261):    at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
09-20 11:13:50.380: W/System.err(29261):    at android.os.Handler.dispatchMessage(Handler.java:99)
09-20 11:13:50.380: W/System.err(29261):    at android.os.Looper.loop(Looper.java:137)
09-20 11:13:50.380: W/System.err(29261):    at android.os.HandlerThread.run(HandlerThread.java:60)
09-20 11:13:50.951: W/System.err(29261): java.net.MalformedURLException: Protocol not found: www.google.com
09-20 11:13:50.951: W/System.err(29261):    at java.net.URL.<init>(URL.java:178)
09-20 11:13:50.951: W/System.err(29261):    at java.net.URL.<init>(URL.java:127)
09-20 11:13:50.951: W/System.err(29261):    at com.example.webdownloader.DownloadService.startDownload(DownloadService.java:40)
09-20 11:13:50.951: W/System.err(29261):    at com.example.webdownloader.DownloadService.onHandleIntent(DownloadService.java:28)
09-20 11:13:50.951: W/System.err(29261):    at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
09-20 11:13:50.961: W/System.err(29261):    at android.os.Handler.dispatchMessage(Handler.java:99)
09-20 11:13:50.961: W/System.err(29261):    at android.os.Looper.loop(Looper.java:137)
09-20 11:13:50.961: W/System.err(29261):    at android.os.HandlerThread.run(HandlerThread.java:60)
09-20 11:13:52.282: W/System.err(29261): java.net.MalformedURLException: Protocol not found: www.google.com
09-20 11:13:52.282: W/System.err(29261):    at java.net.URL.<init>(URL.java:178)
09-20 11:13:52.282: W/System.err(29261):    at java.net.URL.<init>(URL.java:127)
09-20 11:13:52.282: W/System.err(29261):    at com.example.webdownloader.DownloadService.startDownload(DownloadService.java:40)
09-20 11:13:52.282: W/System.err(29261):    at com.example.webdownloader.DownloadService.onHandleIntent(DownloadService.java:28)
09-20 11:13:52.282: W/System.err(29261):    at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
09-20 11:13:52.282: W/System.err(29261):    at android.os.Handler.dispatchMessage(Handler.java:99)
09-20 11:13:52.282: W/System.err(29261):    at android.os.Looper.loop(Looper.java:137)
09-20 11:13:52.282: W/System.err(29261):    at android.os.HandlerThread.run(HandlerThread.java:60)
09-20 11:13:52.523: W/System.err(29261): java.net.MalformedURLException: Protocol not found: www.google.com
09-20 11:13:52.523: W/System.err(29261):    at java.net.URL.<init>(URL.java:178)
09-20 11:13:52.523: W/System.err(29261):    at java.net.URL.<init>(URL.java:127)
09-20 11:13:52.523: W/System.err(29261):    at com.example.webdownloader.DownloadService.startDownload(DownloadService.java:40)
09-20 11:13:52.523: W/System.err(29261):    at com.example.webdownloader.DownloadService.onHandleIntent(DownloadService.java:28)
09-20 11:13:52.523: W/System.err(29261):    at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
09-20 11:13:52.523: W/System.err(29261):    at android.os.Handler.dispatchMessage(Handler.java:99)
09-20 11:13:52.533: W/System.err(29261):    at android.os.Looper.loop(Looper.java:137)
09-20 11:13:52.533: W/System.err(29261):    at android.os.HandlerThread.run(HandlerThread.java:60)

0 个答案:

没有答案