Advertisement
sandro1234

sender java

Sep 10th, 2015
9
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.47 KB | None | 0 0
  1. package tk.khokho.broadsender;
  2.  
  3. import android.content.Intent;
  4. import android.support.v7.app.AppCompatActivity;
  5. import android.os.Bundle;
  6. import android.util.Log;
  7. import android.view.Menu;
  8. import android.view.MenuItem;
  9. import android.view.View;
  10.  
  11. public class Sender extends AppCompatActivity {
  12.  
  13.     @Override
  14.     protected void onCreate(Bundle savedInstanceState) {
  15.         super.onCreate(savedInstanceState);
  16.         setContentView(R.layout.activity_sender);
  17.     }
  18.  
  19.     @Override
  20.     public boolean onCreateOptionsMenu(Menu menu) {
  21.         // Inflate the menu; this adds items to the action bar if it is present.
  22.         getMenuInflater().inflate(R.menu.menu_sender, menu);
  23.         return true;
  24.     }
  25.  
  26.     public void broadcast(View v){
  27.         Log.i("sm", "dsfdvfvs");
  28.         Intent intent = new Intent();
  29.         intent.setAction("tk.khokho.CUSTOM_INTENT");
  30.         intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
  31.         sendBroadcast(intent);
  32.     }
  33.  
  34.     @Override
  35.     public boolean onOptionsItemSelected(MenuItem item) {
  36.         // Handle action bar item clicks here. The action bar will
  37.         // automatically handle clicks on the Home/Up button, so long
  38.         // as you specify a parent activity in AndroidManifest.xml.
  39.         int id = item.getItemId();
  40.  
  41.         //noinspection SimplifiableIfStatement
  42.         if (id == R.id.action_settings) {
  43.             return true;
  44.         }
  45.  
  46.         return super.onOptionsItemSelected(item);
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement