2017-10-24 2 views
1

私は奇妙な種類の問題を抱えています。イメージをフォルダにアップロードして、データベース内の名前(ユーザーのID)と拡張子を保存して、私はSharedPrefMangerを編集していますが、画像の名前と拡張子を保存していますが、フォルダー内の画像は変更されません。ここMySQLからのAndroidイメージリクエスト

はここ

public boolean uploadpicmanager(String id){ 
    SharedPreferences sharedPreferences3 = mCtx.getSharedPreferences(SHARED_PREF_NAME,Context.MODE_PRIVATE); 
    SharedPreferences.Editor editor3 = sharedPreferences3.edit(); 
    editor3.putString(KEY_IMAGE,id); 
    editor3.apply(); 
    return true; 
} 

イメージ名を変更uploadpicmanはイムは画像を読み取る方法ですされてどのようにImはフォルダ内の画像を変更し、

その作業罰金
String uploadId = UUID.randomUUID().toString(); 
    String path = getPath(filepath); 

    try { 
     new MultipartUploadRequest(this,uploadId,Constants.URL_UPLOADPIC) 
       .addFileToUpload(path,"image") 
       .addParameter("id",SharedPrefManager.getInstance(this).getKeyUserId()) 
       .setNotificationConfig(new UploadNotificationConfig()) 
       .setMaxRetries(2) 
       .startUpload(); 
     String extention = path.substring(path.lastIndexOf(".")); 
     String id = SharedPrefManager.getInstance(getApplicationContext()).getKeyUserId(); 
     SharedPrefManager.getInstance(getApplicationContext()).uploadpicmanager(id+extention); 
     Toast.makeText(Profile.this, path, Toast.LENGTH_LONG).show(); 

    } catch (MalformedURLException e) { 
     e.printStackTrace(); 
    } catch (FileNotFoundException e) { 
     e.printStackTrace(); 
    } 

ここで、最初のアップロードのためのその作業の罰金しかし、私は写真を変更するときに変更されません。私がどこにいるのか分からないのですが、

Picasso.with(getApplicationContext()) 
      .load("http://hello.000webhostapp.com/Shop&Go/customers/"+ 
        SharedPrefManager.getInstance(getApplicationContext()).getKeyImage()) 
      .into(profilepic); 

答えて

0

おそらく、Picassoはキャッシュされた画像を読み込みます。

が、これは良い習慣ではありません。もちろん、

.memoryPolicy(MemoryPolicy.NO_CACHE) 
ビルダーの

を追加しようとすると、画像のパス名を変更(およびメモリポリシーを削除する)必要があります。

+1

方法のメモリポリシーを解決できませんか? –

+0

Picasa.with(getApplicationContext()) .load( "http://hello.000webhostapp.com/Shop&Go/customers/" + SharedPrefManager.getInstance(getApplicationContext())。getKeyImage())。memoryPolicy(MemoryPolicy.NO_CACHE ).into(profilepic); –

関連する問題