1 package com.joshuawise.dumload;
3 import java.io.InputStream;
5 import android.app.Activity;
6 import android.app.Service;
7 import android.content.Intent;
8 import android.net.Uri;
9 import android.os.Bundle;
10 import android.os.IBinder;
11 import android.widget.TextView;
12 import android.widget.Toast;
13 import android.util.Log;
15 public class Dumload extends Activity {
16 /** Called when the activity is first created. */
18 public void onCreate(Bundle savedInstanceState) {
19 super.onCreate(savedInstanceState);
20 setContentView(R.layout.main);
21 TextView tv = (TextView)findViewById(R.id.suckit);
22 tv.setText("Suck it.");
25 private void say(String s) {
26 Toast.makeText(getApplicationContext(), s, Toast.LENGTH_SHORT).show();
29 public void onStart() {
32 Intent i = getIntent(); /* i *am* not an intent! */
33 if (i.getAction().equals(Intent.ACTION_SEND))
35 Bundle extras = i.getExtras();
36 Uri uri = (Uri)extras.getParcelable(Intent.EXTRA_STREAM);
38 Log.e("Dumload", "Got a send -- starting service.");
39 // Never let an ML programmer touch Java.
40 android.content.ComponentName cn = getApplicationContext().startService(new Intent().setClass(getApplicationContext(), Uploader.class).setData(uri));
45 Log.e("Dumload", "Started service " + cn.toString() + ".");
47 TextView tv = (TextView)findViewById(R.id.suckit);
48 tv.setText("Action was send: "+uri.toString());
50 TextView tv = (TextView)findViewById(R.id.suckit);
51 tv.setText("Action was something else");