3

i've already looked for a similiar answer but none is working for me. I'm just learning to code in Android Studio, and in doing so i bumped into this warning :

W/ViewRootImpl: Cancelling event due to no window focus: MotionEvent { action=ACTION_CANCEL,

I've a simple activity (Scrolling Activity) with a FloatingActionButton. Here's the code for the activity :

public class ImmobileActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_second);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    String msg = getIntent().getStringExtra(FrontActivity.MESSAGE);
    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);

    fab.setOnClickListener((View v) -> {
            Intent send = new Intent();
            send.setAction(Intent.ACTION_SENDTO);
            send.putExtra(Intent.EXTRA_TEXT,msg);
            send.setType("text/plain");
            String title = getResources().getString(R.string.app_name);
            Intent chooser = Intent.createChooser(send,title);
            if(send.resolveActivity(getPackageManager())!= null) {
                startActivity(chooser);
            }
    });
}

So... i don't know how to implement onTouchEvent(), as it's suggested in this POST Any suggestions?

Community
  • 1
  • 1
sgrumo
  • 615
  • 2
  • 8
  • 24

0 Answers0