Android启动画面 – 来自SD卡的图像?

上周我一直在玩android和一些phonegap代码,并且通过磕磕绊绊,在我的应用程序创建方面相当成功。

我的应用程序使用默认的初始屏幕加载,然后调出各种JSON源以下载所需数据的本地副本。 在执行此操作时,它还会检查是否存在启动屏幕图像的更新版本(可从CMS网站进行编辑)。 如果有,则下载并存储到SD卡。 这非常有效。

我遇到的问题是下次加载应用程序时我想显示新的启动画面。 我下面的代码检查是否存在较新的代码,但我不知道代码然后用新的代码替换默认值:(

到目前为止我的代码是:

package com.interdirect.Harlequin; import java.io.File; import android.app.Activity; import android.os.Bundle; import android.os.Environment; import com.phonegap.*; public class App extends DroidGap { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); String newFolder = "/Harlequin"; String extStorageDirectory = Environment.getExternalStorageDirectory().toString(); File appDirectory = new File(extStorageDirectory + newFolder); appDirectory.mkdirs(); File f = new File(extStorageDirectory + newFolder + "/Images/splash.jpg"); if (f.exists()){ //USE THE FILE ABOVE AS THE SPLASH }else{ super.setIntegerProperty("splashscreen", R.drawable.splash); } super.loadUrl("file:///android_asset/www/index.html",2000); }; }; 

如果有人可以提供上述帮助,那就太棒了,因为我把头发拉到一些我甚至不知道可能的东西上:(

你可以尝试这样的事情

 Bitmap image = BitmapFactory.decodeFile(f); ImageView splashScreen = (ImageView)findViewById(R.id.splashscreen); splashScreen.setImageBitmap(image);