0
私はサードパーティのライブラリを使用して画像をスライドしましたが、SQLite画像URLはインターネットが利用できないときにimagesliderに画像を表示することはできませんが、imageslider.iにはすべての画像が表示されます。はSQLiteでurlのみを知らないimageliderviewでどのように表示することが可能ですか?私はスライダ画像のサードパーティライブラリを使用しましたが、オフラインモードの画像は画像sliderviewに表示されます
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