0
我用第三方库滑动图像,但离线存储我用SQLite整个JSON数据发送到SQLite.IF sqlite有只图片网址时,互联网不可用时间图像不能显示在imageslider,但所有图像显示在imageslider.i不知道在SQLite中只有url 如何有可能显示在imagesliderview。我使用第三方库为滑块图像,但离线模式图像显示在图像slideview
我不想在android下离线模式下显示。
我用这个库编译 'com.daimajia.androidanimations:图书馆:[email protected]'
这是sliderimages离线模式代码:
private void BannerImageOffline() {
String BannerImages = db.getNumbers(Constants.BannerImages);
Log.d(TAG, BannerImages.toString());
if (BannerImages != null) {
try {
JSONObject bannerimages=new JSONObject(BannerImages);
// int status=jsonObject.optInt("status");
String status = bannerimages.optString("status");
if (status.equalsIgnoreCase("200")) {//check the status 200 or not
try {
bannerpath = bannerimages.getString("bannerPath");
} catch (JSONException e) {
e.printStackTrace();
}
JSONArray jsonArray = null;
try {
JSONObject response = bannerimages.getJSONObject("response");
jsonArray = response.getJSONArray(DATA);
if (jsonArray.length() > 0) {
// looping through json and adding to movies list
for (int i = 0; i < jsonArray.length(); i++) {
try {
JSONObject alertObj = jsonArray.getJSONObject(i);
String images = bannerpath + alertObj.getString("banner_name");
HashMap<String, String> map = new HashMap<String, String>();
map.put(FLAG, images);
for (String name : map.keySet()) {
// TextSliderView textSliderView = new TextSliderView(MainActivity.this);
DefaultSliderView textSliderView = new DefaultSliderView(getActivity());
// initialize a SliderLayout
textSliderView
// .description(name)
.image(map.get(name))
.setScaleType(BaseSliderView.ScaleType.Fit)
.setOnSliderClickListener(Home_Page.this);
//add your extra information
textSliderView.bundle(new Bundle());
textSliderView.getBundle()
.putString("extra", name);
mDemoSlider.addSlider(textSliderView);
}
} catch (JSONException e) {
Log.e(TAG, "JSON Parsing error: " + e.getMessage());
}
}
// adapter.notifyDataSetChanged();
}
} catch (JSONException e) {
e.printStackTrace();
}
// stopping swipe refresh
// swipeRefreshLayout.setRefreshing(false);
hidepDialog();
} // condtion check the status 200
else // this is if status falied in runtime
{
Toast.makeText(getActivity(), "Status Failed in Banner Page check ur network connection", Toast.LENGTH_LONG).show();
}
}
catch (JSONException e) {
e.printStackTrace();
}
// If condtion end of the project
}
}
任何解决这个问题很高兴欣赏。
所以..你找到一个解决办法? –
不,我没有找到,但仍然离线模式图像显示在图像滑块,我认为第三方有这样的缓存想这样 – Nivethitha