谁做过用Service下载的示例,并且在notification状态栏显示下载进度!或者谁能把http://www.eoeandroid.com/thread-57762-1-1.html这段代码补充齐了!能知道它的xml和DownloadState是怎么写的!谢谢各位前辈了!

解决方案 »

  1.   

    service用线程来实现下载,原理就是获取流存储在本地,有相应的处理累,eoeandroid好像访问不了,出了问题
      

  2.   

    回复2楼前辈!您稍等一下eoeandroid网站!帮忙看看那个能改不!还有您有示例吗!我QQ:195001405 发给我也行!本人才疏学浅!刚刚接触有很多地方不明白!
      

  3.   

    notification.xml差不多是这样的
    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/linearLayout1"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        >
    <TextView  
    android:id="@+id/textView1"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:text="@string/hello"
        />
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/LinearLayout01"
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        >
    <ImageView  
    android:id="@+id/ImageView01"
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        />
    <Progressbar  
    android:id="@+id/ProgressBar01"
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        />
    <TextView  
    android:id="@+id/TextView01"
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text=""
        />
    </LinearLayout>
    </LinearLayout>
      

  4.   

    下载功能可参考:Android更新下载进度条
      

  5.   

    非常感谢!雨梦!XML我也猜的差不多了!就是那个类,想不明白!
    mList = DownloadState.toList();主要是这句话!没猜到!呵呵~~
      

  6.   

    toList是一个static方法,返回一个ArrayList<DownloadState>对象,DownloadState有四五个成员变量,包括name,url,fileSize和downSize等。url你可以设置成固定的网址,比如一个mp3,一张图片等,就是你要下载的内容的链接。
    其他的看看需要什么就添加什么。
      

  7.   

    呜呜呜~~没人能猜的出 DownloadState 是怎么写的!
      

  8.   

    我也想知道DownloadState是怎么写的……
      

  9.   

    下了android的帮助文档,上面介绍的很详细,接口之类的,要好好利用文档
      

  10.   


    public class DownloadState
    {
    public String name;
    public int fileSize;
    public int downSize;
    public String url; public static ArrayList<DownloadState> toList; }
    这样吗?报错!
      

  11.   

    我想到一个大概的思路了!请各位前辈帮我验证!MainActivity 主要页面
    DownLoadActivity 下载详情页
    MyService Service页,通知状态栏修改状态总体是这样的。
    MainActivity  ->   DownLoadActivity           ->   MyService分步解释。
      (发出指令传递参数要下载,单并不显示DownLoadActiv页
            实际已经在DownLoadAcitvity页下载)  
    1.MainActivity -》 ->DownLoadActivity    (发出指令更新状态栏的进度条,有多个并且添加)
    2. DownLoadActivity     ->    MyService但是现在有这样一个问题!MainActivity、DownLoadActivity都是两个Activity,怎么发送消息还不启动DownLoadActivity,DownLoadActivity还能下载。
    Intent intent=new Intent(MainActivity.this,DownLoadActivity.class);
    startActivity(intent);这样肯定不行!new DownLoadActivity也不行!请各位前辈指点!