2016-07-21 4 views
0

Picassoライブラリを使用して画像URLから画像ビューに画像を読み込んでいますが、いつでも自分のウェブサイト上の画像を変更することができます。でる。HTTP画像リクエストアンドロイド

+1

画像をリクエストする方法と画像の表示方法に関するコードはありますか? – Bill

+0

はい、私はこの断片 ビュービュー= inflater.inflate(R.layout.fragment_news、容器、偽のレイアウトを膨らまその –

+0

パブリックビューonCreateView(LayoutInflater用インフレータ、のViewGroup容器、 バンドルsavedInstanceState){ //ためのコードを有します);ImageButton newsbut =(ImageButton)view.findViewById(R.id.newsbut); Picasso.with(getContext())。load( "https://static.wixstatic.com/media/68e522_523c41242d13446ebdcb5768e74555ac~mv2.png/v1/fill/w_448,h_796,al_c,usm_0.66_1.00_0.01/68e522_523c41242d13446ebdcb5768e74555ac 〜mv2.png ")。into(newsbut); リターンビュー。 } –

答えて

0

pseudocode次試してみてください。

.... 
/* create a service that runs in the background every n amount of time*/ 

/* create a simple http request to your server to check if there are changes */ 

/* if changed == true; then simply notify the activity or whatever you are using */ 

/* to reload the imageView by calling the Picasso method accordingly */ 

/* If the image URL is changed, you can get that from your http request and simply set it to the Picasso method that downloads the image */ 

/* What I would do is use an Event to seamlessly notify the activity or fragment to update image view */ 

は、私は、これはあなたのアイデアを与える願っています。がんばろう!

1

あなたは

Picasso.with(getActivity()).load("http://example.com/image.jpg").into(imageView); 

または活性を有するその断片

を使用している場合は、この場合、その「image.jpgに同じ名前などの拡張子を持つ画像を変更していることを確認してくださいあなたのウェブサイトに今すぐ
Picasso.with(context).load("http://example.com/image.jpg").into(imageView); 

'

+0

Ok。sir ..私は試してみます –

関連する問題