binder 1 failed

0 Suyash Shrivastava · October 22, 2015
While running the recieveBroadcast app...I am getting runtime error  attach of thread binder 1 failed. What does that mean?
i would appreciate any help
Thanks

Post a Reply

Replies

Oldest  Newest  Rating
0 Gary Whitney · October 23, 2015
I reviewed the code from #37 and #38 and it does not use a bindService() so I will assume your thread failed to bind to the Activity that generated it.
I am going to attach my code for you to compare to yours. It should be similar except for the package info and comments. The code works but may not be exactly the same as the tutorial because I tend to personalize it by changing names from Bucky's... to something else.
[source code] Android Development Tutorial - 37 and 38 Broadcasting

//37 note: changed company name in #38

***** MainActivity.java
package glwhitney.info.sendbroadcast;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    public void sendOutBroadcast(View view){
        Intent i = new Intent();// no explict class like last tutorial
        i.setAction("glwhitney.info.sendbroadcast");// use package as a unique identifier.
        i.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); // for all versions of android
        sendBroadcast(i);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }
}

***** activity_main.xml



   



//#38
*****ReceiveBroadcast.java

package info.glwhitney.receivebroadcast;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;

public class ReceiveBroadcast extends BroadcastReceiver {
    public ReceiveBroadcast() {
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        Toast.makeText(context,"Broadcast has been received",Toast.LENGTH_LONG).show();
    }
}


***** Manifest




   
       

           
                .
           
       
   

  • 1

Java / Android Development

107,307 followers
About

Very popular language used to create desktop applications, website applets, and Android apps.

Links
Moderators
Bucky Roberts Administrator