我需要从URL完成图像的下载后开始我的意图,而不需要应用程序本身的用户采取任何行动。完成从url下载图像后如何启动意图?
这是我的活动,首先下载图像,然后它将开始意图。
//download image then start decod intent
public void download(View v)
{
//first download image
new MyAsnyc().execute();
//then start this intent
final Handler handler=new Handler();
final Runnable r = new Runnable()
{
public void run()
{
{
Intent intent1 = new Intent(Test_PROJECTActivity.this, DecodeActivity.class);
File path = Environment
.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
File file = new File(path, "DemoPictureX.png");
Log.d("file", file.getAbsolutePath());
intent1.putExtra("file", file.getAbsolutePath());
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
startActivity(intent1);
}
}
};
handler.postDelayed(r, 5000);
}
的MyAsnyc做精细且正确下载图像,但第二部分从在下载图像,从而该图像将被破坏,因此导致异常,其开始的意图的代码。
如何让意图开始一次图像将准备好并完成下载?
你在哪里下载的形象呢?我没看到电话。 – Kaediil 2012-07-25 13:39:40
在类MyAsnyc和这个呼叫 新的MyAsnyc().execute(); – Start 2012-07-25 13:42:28
你能显示你的清单文件吗? – 2012-07-25 13:51:13