MDRams

Untitled

Oct 31st, 2015
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.71 KB | None | 0 0
  1. package yo.share;
  2.  
  3. import android.content.Intent;
  4. import android.os.Bundle;
  5. import android.support.design.widget.FloatingActionButton;
  6. import android.support.v7.app.AppCompatActivity;
  7. import android.support.v7.widget.Toolbar;
  8. import android.view.Menu;
  9. import android.view.MenuItem;
  10. import android.view.View;
  11. import android.widget.Button;
  12. import android.widget.ImageView;
  13. import android.widget.Toast;
  14.  
  15. public class MainActivity extends AppCompatActivity {
  16.  
  17. Button button;
  18. Button Click = (Button) findViewById(R.id.button);
  19. String result ="";
  20.  
  21.  
  22.  
  23.  
  24. @Override
  25. protected void onCreate(Bundle savedInstanceState) {
  26. super.onCreate(savedInstanceState);
  27. setContentView(R.layout.activity_main);
  28. Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
  29. ImageView Imageview = (ImageView) findViewById(R.id.imageView);
  30. setSupportActionBar(toolbar);
  31.  
  32.  
  33. FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
  34. fab.setOnClickListener(new View.OnClickListener() {
  35. @Override
  36. public void onClick(View view) {
  37. //create the send intent
  38. Intent shareIntent =
  39. new Intent(android.content.Intent.ACTION_SEND);
  40.  
  41. //set the type
  42. shareIntent.setType("text/plain");
  43.  
  44. //add a subject
  45. shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,
  46. "Insert Subject Here");
  47.  
  48. //build the body of the message to be shared
  49. String shareMessage = "Insert message body here.";
  50.  
  51. //add the message
  52. shareIntent.putExtra(android.content.Intent.EXTRA_TEXT,
  53. shareMessage);
  54.  
  55. //start the chooser for sharing
  56. startActivity(Intent.createChooser(shareIntent, getResources().getString(R.string.FinalString)));
  57. }
  58. });
  59.  
  60. }
  61.  
  62. public class Program {
  63. public void main(String[] args) {
  64.  
  65. int value1 = 300;
  66. double value2 = 3.14;
  67. short value3 = 5;
  68. char value4 = 'A';
  69.  
  70. // Create StringBuilder and add four values to it.
  71. final StringBuilder builder = new StringBuilder();
  72. builder.append(value2).append("\n");
  73. builder.append(value3).append("\n");
  74. builder.append(value4);
  75.  
  76. // Display results.
  77. String result = builder.toString();
  78. System.out.println(result);
  79. }
  80. public void onClick(View v) {
  81.  
  82. Imageview.setOnClickListener(new View.OnClickListener() {
  83. builder.append(value1).result.append("\n");
  84. }
  85.  
  86. }
  87. }
  88.  
  89. @Override
  90. public void onClick(View v) {
  91. if (ImageView.isChecked() == true) {
  92. result.add("4");
  93. }
  94. }
  95.  
  96.  
  97.  
  98.  
  99. @Override
  100. public void onClick(View V){
  101. Toast.makeText(getApplicationContext(),result ,Toast.LENGTH_SHORT).show();
  102. }
  103.  
  104.  
  105.  
  106.  
  107. public boolean onCreateOptionsMenu(Menu menu) {
  108. // Inflate the menu; this adds items to the action bar if it is present.
  109. getMenuInflater().inflate(R.menu.menu_main, menu);
  110. return true;
  111. }
  112.  
  113. @Override
  114. public boolean onOptionsItemSelected(MenuItem item) {
  115. // Handle action bar item clicks here. The action bar will
  116. // automatically handle clicks on the Home/Up button, so long
  117. // as you specify a parent activity in AndroidManifest.xml.
  118. int id = item.getItemId();
  119.  
  120. //noinspection SimplifiableIfStatement
  121. if (id == R.id.action_settings) {
  122. return true;
  123. }
  124.  
  125. return super.onOptionsItemSelected(item);
  126. }
  127. }
Advertisement
Add Comment
Please, Sign In to add comment