2016-12-19 3 views
3

私はFirebaseを更新するアプリケーションを作成していますが、それはcannot resolve symbol FirebaseErrorなのでoncancelled関数を書くことはできません。以下FirebaseErrorが解決されていません

マイコード:

package com.test.myapplication; 

import android.content.Intent; 
import android.graphics.Bitmap; 
import android.graphics.BitmapFactory; 
import android.os.Bundle; 
import android.support.annotation.Nullable; 
import android.support.v7.app.AppCompatActivity; 
import android.util.Base64; 
import android.util.Log; 
import android.widget.ImageView; 
import android.widget.ListView; 
import android.widget.RadioButton; 
import android.widget.TextView; 

import static com.test.myapplication.R.id.radioButton5; 
import static com.test.myapplication.R.id.radioButton6; 
import static com.test.myapplication.R.id.radioButton8; 
import com.google.firebase.database.DataSnapshot; 
import com.google.firebase.database.DatabaseReference; 
import com.google.firebase.database.FirebaseDatabase; 
import com.google.firebase.database.Query; 
import com.google.firebase.database.ValueEventListener; 

import java.util.ArrayList; 
import com.google.firebase.auth.FirebaseAuth; 
import com.google.firebase.database.ChildEventListener; 
import com.google.firebase.database.DataSnapshot; 
import com.google.firebase.database.DatabaseError; 
import com.google.firebase.database.DatabaseReference; 
import com.google.firebase.database.FirebaseDatabase; 
import com.google.firebase.database.Query; 

public class OfficialDetail extends AppCompatActivity { 

TextView textViewStreet; 
TextView textViewLat; 
TextView textViewLong; 
TextView textViewDescription; 
TextView textViewSeverity; 
TextView textViewSize; 
TextView textViewEmail; 
RadioButton RadioButton5; 
RadioButton RadioButton6; 
RadioButton RadioButton8; 
DatabaseReference mRef; 
DatabaseReference dRef; 

ArrayList<Report> reportArrayList; 

Report value; 
ListView mListView; 


ImageView imgView; 


@Override 
protected void onCreate(@Nullable Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 

    setContentView(R.layout.fragment_item_detail); 
    RadioButton5 = (RadioButton)findViewById(radioButton5); 
    RadioButton6 = (RadioButton)findViewById(radioButton6); 
    RadioButton8 = (RadioButton)findViewById(radioButton8); 
    Intent intent = getIntent(); 

    initialize(); 


    if(intent!=null) { 

     textViewStreet.setText(intent.getStringExtra("street_of")); 
     textViewLat.setText(intent.getStringExtra("lat_of")); 
     textViewLong.setText(intent.getStringExtra("long_of")); 
     textViewDescription.setText(intent.getStringExtra("descrip_of")); 
     textViewSeverity.setText(intent.getStringExtra("severity_of")); 
     textViewSize.setText(intent.getStringExtra("size_of")); 

     if(intent.getStringExtra("Off").equals("Official")){ 
      RadioButton5.setEnabled(false); 
      RadioButton8.setEnabled(false); 
     }else{ 
      RadioButton5.setEnabled(false); 
      RadioButton6.setEnabled(false); 
     } 
     if (RadioButton6.isChecked()){ 
      reportArrayList = new ArrayList<>(); 


      dRef = FirebaseDatabase.getInstance().getReference(); 
      mRef = dRef.child("report"); 
      Query qRef; 
      qRef = dRef.orderByChild("Status").equalTo("still_there"); 

      qRef.addListenerForSingleValueEvent(new ValueEventListener() { 
       @Override 
       public void onDataChange(DataSnapshot tasksSnapshot) { 
        for (DataSnapshot snapshot: tasksSnapshot.getChildren()) { 
         snapshot.getRef().child("Status").setValue("removal_confirmed"); 
        } 
       } 
       @Override 
       public void onCancelled(**FirebaseError** firebaseError) { 
        System.out.println("The read failed: " + firebaseError.getMessage()); 
       } 
      }); 
     } 
     byte[] decodedString = Base64.decode(intent.getStringExtra("img_of"), Base64.DEFAULT); 
     Bitmap decodedByte = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length); 
     imgView.setImageBitmap(decodedByte); 


    } 

} 

private void initialize(){ 


    textViewStreet = (TextView) findViewById(R.id.textView22); 
    imgView = (ImageView) findViewById(R.id.imageView); 
    textViewDescription = (TextView) findViewById(R.id.item_detail); 
    textViewSeverity = (TextView) findViewById(R.id.textView24); 
    textViewSize = (TextView) findViewById(R.id.textView26); 
    textViewLat = (TextView) findViewById(R.id.textView13); 
    textViewLong = (TextView) findViewById(R.id.textView17); 

} 
} 

私が欠けているimport文がありますか?どうすれば解決できますか?

+0

クリーンでプロジェクトを再構築 –

+0

こんにちは、助けてくれてありがとうございました。それは仕事をしませんでした。 – Nima

+3

エラーの解決方法が見つかりました。私はFirebaseErrorをDatabaseErrorに変更しなければならなかった。 FirebaseErrorは廃止されたようです。 – Nima

答えて

2

DatabaseErrorクラスでFirebaseErrorクラスを変更してみてください。

私は同じ問題を抱えていて、すべてのメソッドコードを削除してAndroid Studioにメソッド定義自体を作成させただけです。その後FirebaseErrorは自動的にDatabaseErrorに置き換えられました。

関連する問題