代码跟随代码导致javascript中的内存泄漏?

时间:2018-03-09 03:20:30

标签: javascript memory-leaks

显然,在这个例子中声明了两个相同名称的函数。结果是后面的函数涵盖了前面的函数。

public class DataSaveActivity extends AppCompatActivity {

public String keyValue;
private RecyclerView mReceipt;
private DatabaseReference mRef;

@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_category);
    Intent intent = getIntent();
    if(intent == null) {
        keyValue = null;
    } else {
        //keyValue = intent.getExtras().getString("key");
        keyValue = intent.getStringExtra("key");
    }

    FirebaseOptions options = new FirebaseOptions.Builder()
            .setApplicationId("docket-web-app")
            .setApiKey("API KEY OF WEB APP")
            .setDatabaseUrl("https://docket-web-app.firebaseio.com")
            .build();
    FirebaseApp.initializeApp(this, options, "secondary");
    final FirebaseDatabase database = FirebaseDatabase.getInstance("secondary");
    mRef = database.getReference().child("Bills").child(keyValue);
    mRef.keepSynced(true);
    mReceipt = (RecyclerView)findViewById(R.id.othersRecycler);
    mReceipt.setHasFixedSize(true);
    mReceipt.setLayoutManager(new LinearLayoutManager(this));

}
//BELOW THIS :recycler viewcode code to fetch data from database

1 个答案:

答案 0 :(得分:0)

不,它不会导致内存泄漏。