Why does the debug report logs “Attempted to finish an input event but the input event receiver has already...












2















I am using a List with ArrayAdapter for the spinner. But on selecting the spinner, the W/InputEventReceiver logs that the input event receiver has already been disposed



The adapter works fine when created with the method .createFromResource() and a static Array of string, but does not seem to work with the List of Strings.



This is My Activity Code



package club.bms.keshav.readersreserve;

import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;

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.ValueEventListener;

import java.util.ArrayList;
import java.util.List;

public class TempActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener {
private List<CharSequence> userList = new ArrayList<>();
private ArrayAdapter<CharSequence> adapter;
private Spinner spinner;
private static final String TAG = "TempActivity";
private String temp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_temp);
userList.clear();
DatabaseReference rootReference = FirebaseDatabase.getInstance().getReference();
rootReference.child(ConstantFields.DATABASE_USER_LIST).addValueEventListener(new ValueEventListener() {
String temp;
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
for(DataSnapshot dataSnapshot1: dataSnapshot.getChildren())
{
temp = dataSnapshot1.child(ConstantFields.DATABASE_USER_NAME).getValue(String.class);
userList.add(temp);
}
}

@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});

spinner = (Spinner) findViewById(R.id.tempSpinner);
adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, userList);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
spinner.setPrompt("SELECT THE CURRENT HOLDER OF THE BOOK");
Log.d(TAG, "onCreate: Adapter Set");
spinner.setOnItemSelectedListener(this);
}


@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
Log.d(TAG, "onItemSelected: ");
}

@Override
public void onNothingSelected(AdapterView<?> parent) {
Log.d(TAG, "onNothingSelected: ");
}
}


None of the log statements get printed in the itemselectedlistener methods.
This is the log statement that gets printed on clicking the spinner.



W/InputEventReceiver: Attempted to finish an input event but the input event receiver has already been disposed.


The spinner just expands on clicking.



Before Clicking the Spinner



After Clicking the Spinner










share|improve this question

























  • provide the code you are using

    – divaPrajapati09
    Jan 1 at 9:52











  • The code in the activity is the code itself

    – Rohit Sharma
    Jan 1 at 13:34











  • your code is absolutely working fine... you just need to notify your adapter when you get the database from firebase. Also dont forget to check if adapter is null

    – divaPrajapati09
    Jan 2 at 5:04
















2















I am using a List with ArrayAdapter for the spinner. But on selecting the spinner, the W/InputEventReceiver logs that the input event receiver has already been disposed



The adapter works fine when created with the method .createFromResource() and a static Array of string, but does not seem to work with the List of Strings.



This is My Activity Code



package club.bms.keshav.readersreserve;

import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;

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.ValueEventListener;

import java.util.ArrayList;
import java.util.List;

public class TempActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener {
private List<CharSequence> userList = new ArrayList<>();
private ArrayAdapter<CharSequence> adapter;
private Spinner spinner;
private static final String TAG = "TempActivity";
private String temp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_temp);
userList.clear();
DatabaseReference rootReference = FirebaseDatabase.getInstance().getReference();
rootReference.child(ConstantFields.DATABASE_USER_LIST).addValueEventListener(new ValueEventListener() {
String temp;
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
for(DataSnapshot dataSnapshot1: dataSnapshot.getChildren())
{
temp = dataSnapshot1.child(ConstantFields.DATABASE_USER_NAME).getValue(String.class);
userList.add(temp);
}
}

@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});

spinner = (Spinner) findViewById(R.id.tempSpinner);
adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, userList);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
spinner.setPrompt("SELECT THE CURRENT HOLDER OF THE BOOK");
Log.d(TAG, "onCreate: Adapter Set");
spinner.setOnItemSelectedListener(this);
}


@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
Log.d(TAG, "onItemSelected: ");
}

@Override
public void onNothingSelected(AdapterView<?> parent) {
Log.d(TAG, "onNothingSelected: ");
}
}


None of the log statements get printed in the itemselectedlistener methods.
This is the log statement that gets printed on clicking the spinner.



W/InputEventReceiver: Attempted to finish an input event but the input event receiver has already been disposed.


The spinner just expands on clicking.



Before Clicking the Spinner



After Clicking the Spinner










share|improve this question

























  • provide the code you are using

    – divaPrajapati09
    Jan 1 at 9:52











  • The code in the activity is the code itself

    – Rohit Sharma
    Jan 1 at 13:34











  • your code is absolutely working fine... you just need to notify your adapter when you get the database from firebase. Also dont forget to check if adapter is null

    – divaPrajapati09
    Jan 2 at 5:04














2












2








2








I am using a List with ArrayAdapter for the spinner. But on selecting the spinner, the W/InputEventReceiver logs that the input event receiver has already been disposed



The adapter works fine when created with the method .createFromResource() and a static Array of string, but does not seem to work with the List of Strings.



This is My Activity Code



package club.bms.keshav.readersreserve;

import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;

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.ValueEventListener;

import java.util.ArrayList;
import java.util.List;

public class TempActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener {
private List<CharSequence> userList = new ArrayList<>();
private ArrayAdapter<CharSequence> adapter;
private Spinner spinner;
private static final String TAG = "TempActivity";
private String temp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_temp);
userList.clear();
DatabaseReference rootReference = FirebaseDatabase.getInstance().getReference();
rootReference.child(ConstantFields.DATABASE_USER_LIST).addValueEventListener(new ValueEventListener() {
String temp;
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
for(DataSnapshot dataSnapshot1: dataSnapshot.getChildren())
{
temp = dataSnapshot1.child(ConstantFields.DATABASE_USER_NAME).getValue(String.class);
userList.add(temp);
}
}

@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});

spinner = (Spinner) findViewById(R.id.tempSpinner);
adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, userList);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
spinner.setPrompt("SELECT THE CURRENT HOLDER OF THE BOOK");
Log.d(TAG, "onCreate: Adapter Set");
spinner.setOnItemSelectedListener(this);
}


@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
Log.d(TAG, "onItemSelected: ");
}

@Override
public void onNothingSelected(AdapterView<?> parent) {
Log.d(TAG, "onNothingSelected: ");
}
}


None of the log statements get printed in the itemselectedlistener methods.
This is the log statement that gets printed on clicking the spinner.



W/InputEventReceiver: Attempted to finish an input event but the input event receiver has already been disposed.


The spinner just expands on clicking.



Before Clicking the Spinner



After Clicking the Spinner










share|improve this question
















I am using a List with ArrayAdapter for the spinner. But on selecting the spinner, the W/InputEventReceiver logs that the input event receiver has already been disposed



The adapter works fine when created with the method .createFromResource() and a static Array of string, but does not seem to work with the List of Strings.



This is My Activity Code



package club.bms.keshav.readersreserve;

import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;

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.ValueEventListener;

import java.util.ArrayList;
import java.util.List;

public class TempActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener {
private List<CharSequence> userList = new ArrayList<>();
private ArrayAdapter<CharSequence> adapter;
private Spinner spinner;
private static final String TAG = "TempActivity";
private String temp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_temp);
userList.clear();
DatabaseReference rootReference = FirebaseDatabase.getInstance().getReference();
rootReference.child(ConstantFields.DATABASE_USER_LIST).addValueEventListener(new ValueEventListener() {
String temp;
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
for(DataSnapshot dataSnapshot1: dataSnapshot.getChildren())
{
temp = dataSnapshot1.child(ConstantFields.DATABASE_USER_NAME).getValue(String.class);
userList.add(temp);
}
}

@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});

spinner = (Spinner) findViewById(R.id.tempSpinner);
adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, userList);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
spinner.setPrompt("SELECT THE CURRENT HOLDER OF THE BOOK");
Log.d(TAG, "onCreate: Adapter Set");
spinner.setOnItemSelectedListener(this);
}


@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
Log.d(TAG, "onItemSelected: ");
}

@Override
public void onNothingSelected(AdapterView<?> parent) {
Log.d(TAG, "onNothingSelected: ");
}
}


None of the log statements get printed in the itemselectedlistener methods.
This is the log statement that gets printed on clicking the spinner.



W/InputEventReceiver: Attempted to finish an input event but the input event receiver has already been disposed.


The spinner just expands on clicking.



Before Clicking the Spinner



After Clicking the Spinner







java android android-studio android-spinner






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 1 at 10:01







Rohit Sharma

















asked Jan 1 at 9:45









Rohit SharmaRohit Sharma

154




154













  • provide the code you are using

    – divaPrajapati09
    Jan 1 at 9:52











  • The code in the activity is the code itself

    – Rohit Sharma
    Jan 1 at 13:34











  • your code is absolutely working fine... you just need to notify your adapter when you get the database from firebase. Also dont forget to check if adapter is null

    – divaPrajapati09
    Jan 2 at 5:04



















  • provide the code you are using

    – divaPrajapati09
    Jan 1 at 9:52











  • The code in the activity is the code itself

    – Rohit Sharma
    Jan 1 at 13:34











  • your code is absolutely working fine... you just need to notify your adapter when you get the database from firebase. Also dont forget to check if adapter is null

    – divaPrajapati09
    Jan 2 at 5:04

















provide the code you are using

– divaPrajapati09
Jan 1 at 9:52





provide the code you are using

– divaPrajapati09
Jan 1 at 9:52













The code in the activity is the code itself

– Rohit Sharma
Jan 1 at 13:34





The code in the activity is the code itself

– Rohit Sharma
Jan 1 at 13:34













your code is absolutely working fine... you just need to notify your adapter when you get the database from firebase. Also dont forget to check if adapter is null

– divaPrajapati09
Jan 2 at 5:04





your code is absolutely working fine... you just need to notify your adapter when you get the database from firebase. Also dont forget to check if adapter is null

– divaPrajapati09
Jan 2 at 5:04












1 Answer
1






active

oldest

votes


















1














rootReference.child(ConstantFields.DATABASE_USER_LIST).addValueEventListener(new ValueEventListener() {
String temp;
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
for(DataSnapshot dataSnapshot1: dataSnapshot.getChildren())
{
temp = dataSnapshot1.child(ConstantFields.DATABASE_USER_NAME).getValue(String.class);
userList.add(temp);
if(adapter!=null){
adapter.notifyDataSetChanged();
}
}

@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});





share|improve this answer
























  • This works perfectly fine thank you. But do we need to call notifyDataSetChanged(), after every addition or would it work the same if call this method outside the loop?

    – Rohit Sharma
    Jan 2 at 6:33











  • It works the same if i notify the adapter after the formation of the list.

    – Rohit Sharma
    Jan 2 at 6:40











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%2f53994441%2fwhy-does-the-debug-report-logs-attempted-to-finish-an-input-event-but-the-input%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














rootReference.child(ConstantFields.DATABASE_USER_LIST).addValueEventListener(new ValueEventListener() {
String temp;
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
for(DataSnapshot dataSnapshot1: dataSnapshot.getChildren())
{
temp = dataSnapshot1.child(ConstantFields.DATABASE_USER_NAME).getValue(String.class);
userList.add(temp);
if(adapter!=null){
adapter.notifyDataSetChanged();
}
}

@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});





share|improve this answer
























  • This works perfectly fine thank you. But do we need to call notifyDataSetChanged(), after every addition or would it work the same if call this method outside the loop?

    – Rohit Sharma
    Jan 2 at 6:33











  • It works the same if i notify the adapter after the formation of the list.

    – Rohit Sharma
    Jan 2 at 6:40
















1














rootReference.child(ConstantFields.DATABASE_USER_LIST).addValueEventListener(new ValueEventListener() {
String temp;
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
for(DataSnapshot dataSnapshot1: dataSnapshot.getChildren())
{
temp = dataSnapshot1.child(ConstantFields.DATABASE_USER_NAME).getValue(String.class);
userList.add(temp);
if(adapter!=null){
adapter.notifyDataSetChanged();
}
}

@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});





share|improve this answer
























  • This works perfectly fine thank you. But do we need to call notifyDataSetChanged(), after every addition or would it work the same if call this method outside the loop?

    – Rohit Sharma
    Jan 2 at 6:33











  • It works the same if i notify the adapter after the formation of the list.

    – Rohit Sharma
    Jan 2 at 6:40














1












1








1







rootReference.child(ConstantFields.DATABASE_USER_LIST).addValueEventListener(new ValueEventListener() {
String temp;
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
for(DataSnapshot dataSnapshot1: dataSnapshot.getChildren())
{
temp = dataSnapshot1.child(ConstantFields.DATABASE_USER_NAME).getValue(String.class);
userList.add(temp);
if(adapter!=null){
adapter.notifyDataSetChanged();
}
}

@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});





share|improve this answer













rootReference.child(ConstantFields.DATABASE_USER_LIST).addValueEventListener(new ValueEventListener() {
String temp;
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
for(DataSnapshot dataSnapshot1: dataSnapshot.getChildren())
{
temp = dataSnapshot1.child(ConstantFields.DATABASE_USER_NAME).getValue(String.class);
userList.add(temp);
if(adapter!=null){
adapter.notifyDataSetChanged();
}
}

@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});






share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 2 at 5:06









divaPrajapati09divaPrajapati09

979




979













  • This works perfectly fine thank you. But do we need to call notifyDataSetChanged(), after every addition or would it work the same if call this method outside the loop?

    – Rohit Sharma
    Jan 2 at 6:33











  • It works the same if i notify the adapter after the formation of the list.

    – Rohit Sharma
    Jan 2 at 6:40



















  • This works perfectly fine thank you. But do we need to call notifyDataSetChanged(), after every addition or would it work the same if call this method outside the loop?

    – Rohit Sharma
    Jan 2 at 6:33











  • It works the same if i notify the adapter after the formation of the list.

    – Rohit Sharma
    Jan 2 at 6:40

















This works perfectly fine thank you. But do we need to call notifyDataSetChanged(), after every addition or would it work the same if call this method outside the loop?

– Rohit Sharma
Jan 2 at 6:33





This works perfectly fine thank you. But do we need to call notifyDataSetChanged(), after every addition or would it work the same if call this method outside the loop?

– Rohit Sharma
Jan 2 at 6:33













It works the same if i notify the adapter after the formation of the list.

– Rohit Sharma
Jan 2 at 6:40





It works the same if i notify the adapter after the formation of the list.

– Rohit Sharma
Jan 2 at 6:40




















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%2f53994441%2fwhy-does-the-debug-report-logs-attempted-to-finish-an-input-event-but-the-input%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

android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

SQL update select statement

'app-layout' is not a known element: how to share Component with different Modules