Android Open Source - dCache-Cloud Share Data Activity






From Project

Back to project page dCache-Cloud.

License

The source code is released under:

Copyright ? 2013, Michael Stapelberg and contributors All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following ...

If you think the Android project dCache-Cloud listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package de.desy.dCacheCloud.Activities;
//from  w  ww  .  j  ava2s.com
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import de.desy.dCacheCloud.R;

public class ShareDataActivity extends Activity implements android.view.View.OnClickListener {

  private String content;
  private TextView tvData;
  private TextView tvInfo;
  private Button btnCopy;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    
    content = getIntent().getExtras().getString("DATA");
    setContentView(R.layout.activity_data_to_share);
    tvData = (TextView)findViewById(R.id.tvShareData);
    tvInfo = (TextView) findViewById(R.id.tvInfo);
    btnCopy = (Button) findViewById(R.id.btnCopyToClipboard);
    btnCopy.setOnClickListener(this);
    
    super.onCreate(savedInstanceState);
  }
  
  

  @Override
  protected void onResume() {

    tvData.setText(content);
    tvInfo.setText("Please send this Data to your Friend");
    super.onResume();
  }



  @SuppressWarnings("deprecation")
  @Override
  public void onClick(View v) {

    switch (v.getId())
    {
    case R.id.btnCopyToClipboard:
      int sdk = android.os.Build.VERSION.SDK_INT;
      if(sdk < android.os.Build.VERSION_CODES.HONEYCOMB) {
          android.text.ClipboardManager clipboard = (android.text.ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
          clipboard.setText("text to clip");
      } else {
          android.content.ClipboardManager clipboard = (android.content.ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); 
          android.content.ClipData clip = android.content.ClipData.newPlainText("text label","text to clip");
          clipboard.setPrimaryClip(clip);
      }
      
      Toast.makeText(getApplicationContext(), "Data copied!", Toast.LENGTH_LONG).show();
      finish();
    }
    
  }

  
  
}




Java Source Code List

External.Contents.java
External.IntentIntegrator.java
External.IntentResult.java
External.QRCodeEncoder.java
de.desy.dCacheCloud.CountingInputStreamEntity.java
de.desy.dCacheCloud.CryptoHelper.java
de.desy.dCacheCloud.DatabaseHelper.java
de.desy.dCacheCloud.DownloadService.java
de.desy.dCacheCloud.KeyStoreHelper.java
de.desy.dCacheCloud.MySSLSocketFactory.java
de.desy.dCacheCloud.ServerHelper.java
de.desy.dCacheCloud.UploadService.java
de.desy.dCacheCloud.Activities.FriendFoundActivity.java
de.desy.dCacheCloud.Activities.ImportDataActivity.java
de.desy.dCacheCloud.Activities.MainActivity.java
de.desy.dCacheCloud.Activities.ProfileActivity.java
de.desy.dCacheCloud.Activities.ServerViewActivity.java
de.desy.dCacheCloud.Activities.SettingsActivity.java
de.desy.dCacheCloud.Activities.ShareDataActivity.java
de.desy.dCacheCloud.Activities.ShareWithFriendActivity.java
de.desy.dCacheCloud.Activities.UploadActivity.java
de.desy.dCacheCloud.Activities.UserPasswordActivity.java
de.desy.dCacheCloud.BCReceiver.NetworkReceiver.java
de.desy.dCacheCloud.BCReceiver.NewMediaReceiver.java