Searching in Firebase Null with onClick ListenerAvoiding != null statementsIs null check needed before calling instanceof?Why does EditText retain its Activity's Context in Ice Cream SandwichForce close onClick of ImageButton, can't figure out whyEditText & Enter keyAdding Social Media Share Logic From Firebase in AndroidYouTube Player crashes (java.lang.NullPointerException, null object reference)java.lang.NullPointerException when invoking onLoadFinished()Search Firestore query don't show data in RecycleViewHow to add child(Product) under a child(Store) in Firebase Database using RecyclerView

What is the Title of this fable where a Mongoose is getting married

Which is the best password hashing algorithm in .Net Core?

Given a specific computer system, is it possible to estimate the actual precise run time of a piece of Assembly code

Remove ads in Viber for PC

Meaning of "educating the ice"

Visiting girlfriend in the USA

How to check status of Wi-Fi adapter through command line?

Why don't they build airplanes from 3D printer plastic?

Ways you can end up paying interest on a credit card if you pay the full amount back in due time

If the UK government illegally doesn't ask for article 50 extension, can parliament do it instead?

Why didn't Thatcher give Hong Kong to Taiwan?

In chocolate terminology, what is the name of thinly sliced leaf-shaped toppings made from hot, smooth chocolate, used to form flower petals?

Are manifolds admitting a circle foliation covered by manifolds with a (non-trivial) circle action?

Displaying minutes in HH:MM format

Some questions about Lightning and Tor

Using GNU screen, I get raw prompt with backslashes

Is mathematics truth?

How to align values in table according to the pm and point?

How to fit Schwalbe Marathon Plus 28-622 on 622-16 rim

What is a "fat pointer" in Rust?

Is torque as fundamental a concept as force?

Why do old games use flashing as means of showing damage?

One hour 10 min layover in Newark; International -> Domestic connection. Enough time to clear customs?

Can a country avoid prosecution for crimes against humanity by denying it happened?



Searching in Firebase Null with onClick Listener


Avoiding != null statementsIs null check needed before calling instanceof?Why does EditText retain its Activity's Context in Ice Cream SandwichForce close onClick of ImageButton, can't figure out whyEditText & Enter keyAdding Social Media Share Logic From Firebase in AndroidYouTube Player crashes (java.lang.NullPointerException, null object reference)java.lang.NullPointerException when invoking onLoadFinished()Search Firestore query don't show data in RecycleViewHow to add child(Product) under a child(Store) in Firebase Database using RecyclerView






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I am trying to search for the information in my firebase db, and I am not able to do so.



This is the class in which I'm searching from:



private FirebaseRecyclerAdapter<DjProfile, ResultsViewHolder> firebaseRecyclerAdapter;
public static Query query;

public static String searchData;
DatabaseReference mProfileDatabase;
@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_attendee_landing);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);


final RecyclerView recyclerView = findViewById(R.id.results_recycler);
recyclerView.setLayoutManager(new LinearLayoutManager(this));

final EditText t = (EditText) findViewById(R.id.DjNameET);

mProfileDatabase = FirebaseDatabase.getInstance().getReference();

t.setOnEditorActionListener(new TextView.OnEditorActionListener()
@Override
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent)
if(i == EditorInfo.IME_ACTION_SEARCH)

searchData = t.getText().toString();


return true;

return false;

);

ImageButton imgB= (ImageButton) findViewById(R.id.searchBtn);

imgB.setOnClickListener(new View.OnClickListener()

@Override
public void onClick(View view)

query = mProfileDatabase.orderByChild("djprofile")
.startAt(searchData)
.endAt(searchData + "uf8ff");



);
FirebaseRecyclerOptions<DjProfile> firebaseRecyclerOptions = new FirebaseRecyclerOptions.Builder<DjProfile>()
.setQuery(query, DjProfile.class)
.build();
firebaseRecyclerAdapter = new FirebaseRecyclerAdapter<DjProfile, ResultsViewHolder>(firebaseRecyclerOptions)


@NonNull
@Override
public ResultsViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i)
View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.searchitem_list, viewGroup, false);

return new ResultsViewHolder(view);


@Override
protected void onBindViewHolder(@NonNull ResultsViewHolder holder, int position, @NonNull DjProfile model)
holder.setDjProfile(model);

;
recyclerView.setAdapter(firebaseRecyclerAdapter);




@Override
protected void onStart()

super.onStart();
firebaseRecyclerAdapter.startListening();





Here is the exception I am getting: (says to be occuring in the onStart() method)




java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.firebase.database.ChildEventListener com.google.firebase.database.Query.addChildEventListener(com.google.firebase.database.ChildEventListener)' on a null object reference




Any help as to why this is null would be greatly appreciated!










share|improve this question





















  • 1





    The value of query is null and throw this exception. According to the source code, the query is only assigned after the imgB is clicked.

    – Liem Vo
    Mar 28 at 2:29











  • I understand that. But I want to be able to search for something in that query once that ImageButton is clicked

    – beastlyCoder
    Mar 28 at 2:33

















0















I am trying to search for the information in my firebase db, and I am not able to do so.



This is the class in which I'm searching from:



private FirebaseRecyclerAdapter<DjProfile, ResultsViewHolder> firebaseRecyclerAdapter;
public static Query query;

public static String searchData;
DatabaseReference mProfileDatabase;
@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_attendee_landing);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);


final RecyclerView recyclerView = findViewById(R.id.results_recycler);
recyclerView.setLayoutManager(new LinearLayoutManager(this));

final EditText t = (EditText) findViewById(R.id.DjNameET);

mProfileDatabase = FirebaseDatabase.getInstance().getReference();

t.setOnEditorActionListener(new TextView.OnEditorActionListener()
@Override
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent)
if(i == EditorInfo.IME_ACTION_SEARCH)

searchData = t.getText().toString();


return true;

return false;

);

ImageButton imgB= (ImageButton) findViewById(R.id.searchBtn);

imgB.setOnClickListener(new View.OnClickListener()

@Override
public void onClick(View view)

query = mProfileDatabase.orderByChild("djprofile")
.startAt(searchData)
.endAt(searchData + "uf8ff");



);
FirebaseRecyclerOptions<DjProfile> firebaseRecyclerOptions = new FirebaseRecyclerOptions.Builder<DjProfile>()
.setQuery(query, DjProfile.class)
.build();
firebaseRecyclerAdapter = new FirebaseRecyclerAdapter<DjProfile, ResultsViewHolder>(firebaseRecyclerOptions)


@NonNull
@Override
public ResultsViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i)
View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.searchitem_list, viewGroup, false);

return new ResultsViewHolder(view);


@Override
protected void onBindViewHolder(@NonNull ResultsViewHolder holder, int position, @NonNull DjProfile model)
holder.setDjProfile(model);

;
recyclerView.setAdapter(firebaseRecyclerAdapter);




@Override
protected void onStart()

super.onStart();
firebaseRecyclerAdapter.startListening();





Here is the exception I am getting: (says to be occuring in the onStart() method)




java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.firebase.database.ChildEventListener com.google.firebase.database.Query.addChildEventListener(com.google.firebase.database.ChildEventListener)' on a null object reference




Any help as to why this is null would be greatly appreciated!










share|improve this question





















  • 1





    The value of query is null and throw this exception. According to the source code, the query is only assigned after the imgB is clicked.

    – Liem Vo
    Mar 28 at 2:29











  • I understand that. But I want to be able to search for something in that query once that ImageButton is clicked

    – beastlyCoder
    Mar 28 at 2:33













0












0








0








I am trying to search for the information in my firebase db, and I am not able to do so.



This is the class in which I'm searching from:



private FirebaseRecyclerAdapter<DjProfile, ResultsViewHolder> firebaseRecyclerAdapter;
public static Query query;

public static String searchData;
DatabaseReference mProfileDatabase;
@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_attendee_landing);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);


final RecyclerView recyclerView = findViewById(R.id.results_recycler);
recyclerView.setLayoutManager(new LinearLayoutManager(this));

final EditText t = (EditText) findViewById(R.id.DjNameET);

mProfileDatabase = FirebaseDatabase.getInstance().getReference();

t.setOnEditorActionListener(new TextView.OnEditorActionListener()
@Override
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent)
if(i == EditorInfo.IME_ACTION_SEARCH)

searchData = t.getText().toString();


return true;

return false;

);

ImageButton imgB= (ImageButton) findViewById(R.id.searchBtn);

imgB.setOnClickListener(new View.OnClickListener()

@Override
public void onClick(View view)

query = mProfileDatabase.orderByChild("djprofile")
.startAt(searchData)
.endAt(searchData + "uf8ff");



);
FirebaseRecyclerOptions<DjProfile> firebaseRecyclerOptions = new FirebaseRecyclerOptions.Builder<DjProfile>()
.setQuery(query, DjProfile.class)
.build();
firebaseRecyclerAdapter = new FirebaseRecyclerAdapter<DjProfile, ResultsViewHolder>(firebaseRecyclerOptions)


@NonNull
@Override
public ResultsViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i)
View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.searchitem_list, viewGroup, false);

return new ResultsViewHolder(view);


@Override
protected void onBindViewHolder(@NonNull ResultsViewHolder holder, int position, @NonNull DjProfile model)
holder.setDjProfile(model);

;
recyclerView.setAdapter(firebaseRecyclerAdapter);




@Override
protected void onStart()

super.onStart();
firebaseRecyclerAdapter.startListening();





Here is the exception I am getting: (says to be occuring in the onStart() method)




java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.firebase.database.ChildEventListener com.google.firebase.database.Query.addChildEventListener(com.google.firebase.database.ChildEventListener)' on a null object reference




Any help as to why this is null would be greatly appreciated!










share|improve this question
















I am trying to search for the information in my firebase db, and I am not able to do so.



This is the class in which I'm searching from:



private FirebaseRecyclerAdapter<DjProfile, ResultsViewHolder> firebaseRecyclerAdapter;
public static Query query;

public static String searchData;
DatabaseReference mProfileDatabase;
@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_attendee_landing);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);


final RecyclerView recyclerView = findViewById(R.id.results_recycler);
recyclerView.setLayoutManager(new LinearLayoutManager(this));

final EditText t = (EditText) findViewById(R.id.DjNameET);

mProfileDatabase = FirebaseDatabase.getInstance().getReference();

t.setOnEditorActionListener(new TextView.OnEditorActionListener()
@Override
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent)
if(i == EditorInfo.IME_ACTION_SEARCH)

searchData = t.getText().toString();


return true;

return false;

);

ImageButton imgB= (ImageButton) findViewById(R.id.searchBtn);

imgB.setOnClickListener(new View.OnClickListener()

@Override
public void onClick(View view)

query = mProfileDatabase.orderByChild("djprofile")
.startAt(searchData)
.endAt(searchData + "uf8ff");



);
FirebaseRecyclerOptions<DjProfile> firebaseRecyclerOptions = new FirebaseRecyclerOptions.Builder<DjProfile>()
.setQuery(query, DjProfile.class)
.build();
firebaseRecyclerAdapter = new FirebaseRecyclerAdapter<DjProfile, ResultsViewHolder>(firebaseRecyclerOptions)


@NonNull
@Override
public ResultsViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i)
View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.searchitem_list, viewGroup, false);

return new ResultsViewHolder(view);


@Override
protected void onBindViewHolder(@NonNull ResultsViewHolder holder, int position, @NonNull DjProfile model)
holder.setDjProfile(model);

;
recyclerView.setAdapter(firebaseRecyclerAdapter);




@Override
protected void onStart()

super.onStart();
firebaseRecyclerAdapter.startListening();





Here is the exception I am getting: (says to be occuring in the onStart() method)




java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.firebase.database.ChildEventListener com.google.firebase.database.Query.addChildEventListener(com.google.firebase.database.ChildEventListener)' on a null object reference




Any help as to why this is null would be greatly appreciated!







android firebase-realtime-database nullpointerexception






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 28 at 8:50









Chandrani Chatterjee

1,1427 silver badges20 bronze badges




1,1427 silver badges20 bronze badges










asked Mar 28 at 1:49









beastlyCoderbeastlyCoder

1,0771 gold badge11 silver badges34 bronze badges




1,0771 gold badge11 silver badges34 bronze badges










  • 1





    The value of query is null and throw this exception. According to the source code, the query is only assigned after the imgB is clicked.

    – Liem Vo
    Mar 28 at 2:29











  • I understand that. But I want to be able to search for something in that query once that ImageButton is clicked

    – beastlyCoder
    Mar 28 at 2:33












  • 1





    The value of query is null and throw this exception. According to the source code, the query is only assigned after the imgB is clicked.

    – Liem Vo
    Mar 28 at 2:29











  • I understand that. But I want to be able to search for something in that query once that ImageButton is clicked

    – beastlyCoder
    Mar 28 at 2:33







1




1





The value of query is null and throw this exception. According to the source code, the query is only assigned after the imgB is clicked.

– Liem Vo
Mar 28 at 2:29





The value of query is null and throw this exception. According to the source code, the query is only assigned after the imgB is clicked.

– Liem Vo
Mar 28 at 2:29













I understand that. But I want to be able to search for something in that query once that ImageButton is clicked

– beastlyCoder
Mar 28 at 2:33





I understand that. But I want to be able to search for something in that query once that ImageButton is clicked

– beastlyCoder
Mar 28 at 2:33












1 Answer
1






active

oldest

votes


















1















To be able to initialize the adapter, you need to have a valid query. And to be able to create the query, you need to have the searchData. This means that the initialization of the firebaseRecyclerAdapter should happen inside the onClick.



imgB.setOnClickListener(new View.OnClickListener()

@Override
public void onClick(View view)

query = mProfileDatabase.orderByChild("djprofile")
.startAt(searchData)
.endAt(searchData + "uf8ff");

FirebaseRecyclerOptions<DjProfile> firebaseRecyclerOptions = new FirebaseRecyclerOptions.Builder<DjProfile>()
.setQuery(query, DjProfile.class)
.build();
firebaseRecyclerAdapter = new FirebaseRecyclerAdapter<DjProfile, ResultsViewHolder>(firebaseRecyclerOptions)


@NonNull
@Override
public ResultsViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i)
View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.searchitem_list, viewGroup, false);

return new ResultsViewHolder(view);


@Override
protected void onBindViewHolder(@NonNull ResultsViewHolder holder, int position, @NonNull DjProfile model)
holder.setDjProfile(model);

;
recyclerView.setAdapter(firebaseRecyclerAdapter);

);





share|improve this answer

























  • I am now getting a NullPointerException in my onStart() method when I tell the activity to start listening to the firebaseRecyclerAdapter

    – beastlyCoder
    Mar 28 at 19:59











  • Well yes, that would make sense if you call startListening on an adapter that hasn't been created yet. You should probably move that call to the end of the onClick.

    – Frank van Puffelen
    Mar 28 at 21:53











  • Yeah I've fixed it :)

    – beastlyCoder
    Mar 28 at 21:53










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55389019%2fsearching-in-firebase-null-with-onclick-listener%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1















To be able to initialize the adapter, you need to have a valid query. And to be able to create the query, you need to have the searchData. This means that the initialization of the firebaseRecyclerAdapter should happen inside the onClick.



imgB.setOnClickListener(new View.OnClickListener()

@Override
public void onClick(View view)

query = mProfileDatabase.orderByChild("djprofile")
.startAt(searchData)
.endAt(searchData + "uf8ff");

FirebaseRecyclerOptions<DjProfile> firebaseRecyclerOptions = new FirebaseRecyclerOptions.Builder<DjProfile>()
.setQuery(query, DjProfile.class)
.build();
firebaseRecyclerAdapter = new FirebaseRecyclerAdapter<DjProfile, ResultsViewHolder>(firebaseRecyclerOptions)


@NonNull
@Override
public ResultsViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i)
View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.searchitem_list, viewGroup, false);

return new ResultsViewHolder(view);


@Override
protected void onBindViewHolder(@NonNull ResultsViewHolder holder, int position, @NonNull DjProfile model)
holder.setDjProfile(model);

;
recyclerView.setAdapter(firebaseRecyclerAdapter);

);





share|improve this answer

























  • I am now getting a NullPointerException in my onStart() method when I tell the activity to start listening to the firebaseRecyclerAdapter

    – beastlyCoder
    Mar 28 at 19:59











  • Well yes, that would make sense if you call startListening on an adapter that hasn't been created yet. You should probably move that call to the end of the onClick.

    – Frank van Puffelen
    Mar 28 at 21:53











  • Yeah I've fixed it :)

    – beastlyCoder
    Mar 28 at 21:53















1















To be able to initialize the adapter, you need to have a valid query. And to be able to create the query, you need to have the searchData. This means that the initialization of the firebaseRecyclerAdapter should happen inside the onClick.



imgB.setOnClickListener(new View.OnClickListener()

@Override
public void onClick(View view)

query = mProfileDatabase.orderByChild("djprofile")
.startAt(searchData)
.endAt(searchData + "uf8ff");

FirebaseRecyclerOptions<DjProfile> firebaseRecyclerOptions = new FirebaseRecyclerOptions.Builder<DjProfile>()
.setQuery(query, DjProfile.class)
.build();
firebaseRecyclerAdapter = new FirebaseRecyclerAdapter<DjProfile, ResultsViewHolder>(firebaseRecyclerOptions)


@NonNull
@Override
public ResultsViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i)
View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.searchitem_list, viewGroup, false);

return new ResultsViewHolder(view);


@Override
protected void onBindViewHolder(@NonNull ResultsViewHolder holder, int position, @NonNull DjProfile model)
holder.setDjProfile(model);

;
recyclerView.setAdapter(firebaseRecyclerAdapter);

);





share|improve this answer

























  • I am now getting a NullPointerException in my onStart() method when I tell the activity to start listening to the firebaseRecyclerAdapter

    – beastlyCoder
    Mar 28 at 19:59











  • Well yes, that would make sense if you call startListening on an adapter that hasn't been created yet. You should probably move that call to the end of the onClick.

    – Frank van Puffelen
    Mar 28 at 21:53











  • Yeah I've fixed it :)

    – beastlyCoder
    Mar 28 at 21:53













1














1










1









To be able to initialize the adapter, you need to have a valid query. And to be able to create the query, you need to have the searchData. This means that the initialization of the firebaseRecyclerAdapter should happen inside the onClick.



imgB.setOnClickListener(new View.OnClickListener()

@Override
public void onClick(View view)

query = mProfileDatabase.orderByChild("djprofile")
.startAt(searchData)
.endAt(searchData + "uf8ff");

FirebaseRecyclerOptions<DjProfile> firebaseRecyclerOptions = new FirebaseRecyclerOptions.Builder<DjProfile>()
.setQuery(query, DjProfile.class)
.build();
firebaseRecyclerAdapter = new FirebaseRecyclerAdapter<DjProfile, ResultsViewHolder>(firebaseRecyclerOptions)


@NonNull
@Override
public ResultsViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i)
View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.searchitem_list, viewGroup, false);

return new ResultsViewHolder(view);


@Override
protected void onBindViewHolder(@NonNull ResultsViewHolder holder, int position, @NonNull DjProfile model)
holder.setDjProfile(model);

;
recyclerView.setAdapter(firebaseRecyclerAdapter);

);





share|improve this answer













To be able to initialize the adapter, you need to have a valid query. And to be able to create the query, you need to have the searchData. This means that the initialization of the firebaseRecyclerAdapter should happen inside the onClick.



imgB.setOnClickListener(new View.OnClickListener()

@Override
public void onClick(View view)

query = mProfileDatabase.orderByChild("djprofile")
.startAt(searchData)
.endAt(searchData + "uf8ff");

FirebaseRecyclerOptions<DjProfile> firebaseRecyclerOptions = new FirebaseRecyclerOptions.Builder<DjProfile>()
.setQuery(query, DjProfile.class)
.build();
firebaseRecyclerAdapter = new FirebaseRecyclerAdapter<DjProfile, ResultsViewHolder>(firebaseRecyclerOptions)


@NonNull
@Override
public ResultsViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i)
View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.searchitem_list, viewGroup, false);

return new ResultsViewHolder(view);


@Override
protected void onBindViewHolder(@NonNull ResultsViewHolder holder, int position, @NonNull DjProfile model)
holder.setDjProfile(model);

;
recyclerView.setAdapter(firebaseRecyclerAdapter);

);






share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 28 at 3:29









Frank van PuffelenFrank van Puffelen

273k36 gold badges443 silver badges464 bronze badges




273k36 gold badges443 silver badges464 bronze badges















  • I am now getting a NullPointerException in my onStart() method when I tell the activity to start listening to the firebaseRecyclerAdapter

    – beastlyCoder
    Mar 28 at 19:59











  • Well yes, that would make sense if you call startListening on an adapter that hasn't been created yet. You should probably move that call to the end of the onClick.

    – Frank van Puffelen
    Mar 28 at 21:53











  • Yeah I've fixed it :)

    – beastlyCoder
    Mar 28 at 21:53

















  • I am now getting a NullPointerException in my onStart() method when I tell the activity to start listening to the firebaseRecyclerAdapter

    – beastlyCoder
    Mar 28 at 19:59











  • Well yes, that would make sense if you call startListening on an adapter that hasn't been created yet. You should probably move that call to the end of the onClick.

    – Frank van Puffelen
    Mar 28 at 21:53











  • Yeah I've fixed it :)

    – beastlyCoder
    Mar 28 at 21:53
















I am now getting a NullPointerException in my onStart() method when I tell the activity to start listening to the firebaseRecyclerAdapter

– beastlyCoder
Mar 28 at 19:59





I am now getting a NullPointerException in my onStart() method when I tell the activity to start listening to the firebaseRecyclerAdapter

– beastlyCoder
Mar 28 at 19:59













Well yes, that would make sense if you call startListening on an adapter that hasn't been created yet. You should probably move that call to the end of the onClick.

– Frank van Puffelen
Mar 28 at 21:53





Well yes, that would make sense if you call startListening on an adapter that hasn't been created yet. You should probably move that call to the end of the onClick.

– Frank van Puffelen
Mar 28 at 21:53













Yeah I've fixed it :)

– beastlyCoder
Mar 28 at 21:53





Yeah I've fixed it :)

– beastlyCoder
Mar 28 at 21:53








Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55389019%2fsearching-in-firebase-null-with-onclick-listener%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Obelisk of Theodosius Contents History Description Notes Bibliography Further reading External links Navigation menuAge of spirituality : late antique and early Christian art, third to seventh centuryOver 60 picturesObelisks of the World41°00′21.24″N 28°58′31.43″E / 41.0059000°N 28.9753972°E / 41.0059000; 28.97539727724550-7235741376235741376

밀양 대씨 역사 각주 함께 보기 둘러보기 메뉴밀양 대씨

1973년 목차 사건 문화 탄생 사망 노벨상 달력 둘러보기 메뉴