どこにコードを追加すればよいですか?私は多くの答えを探しましたが、私のコードに追加する正確な場所を見つけることができませんでした。私を助け新しい投稿をrecyclerviewのトップに追加するにはどうすればよいですか?
private void startPosting() {
mProgress.setMessage("Posting to Blog....");
final String title_val = mPostTitle.getText().toString().trim();
final String desc_val = mPostdesc.getText().toString().trim();
final String date_val=txtDate.getText().toString().trim();
if (!TextUtils.isEmpty(title_val) && !TextUtils.isEmpty(desc_val) && mImageUri != null) {
mProgress.show();
StorageReference filepath =mStorage.child("Blog_Images").child(mImageUri.getLastPathSegment());
filepath.putFile(mImageUri).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
@SuppressWarnings("VisibleForTests") Uri downloadUrl = taskSnapshot.getDownloadUrl();
DatabaseReference newPost = mDatabase.push();
newPost.child("title").setValue(title_val);
newPost.child("desc").setValue(desc_val);
newPost.child("Date").setValue(date_val);
newPost.child("image").setValue(downloadUrl.toString());
mProgress.dismiss();
startActivity(new Intent(PostActivity.this,MainActivity.class));
}
あなたの質問にsetStackFromEnd(boolean)メソッドを使用する必要があります。たぶん、https://stackoverflow.com/help/how-to-askは質問の改善に役立ちます。 – Markus