Jan 9, 2015

android uri intent

Sometimes we need sending 'URI' between activity.

If you get URI using intent.getExtra, you can see NullpointException.

So we must be using this method.

First, using 'intent.putExtra()' and 'intent.getParacelableExtra()'

  1. send -> putExtra("uri",urivalue);
  2. receive -> Uri urivalue=getParcelableExtra("uri");

Second, Uri parsing.

Send string value and receive string value.

  1. send -> putExtra("uri",urivalue.toString);
  2. receive -> String geturi=getStringExtra("uri");
  3.            Uri urivalue=Uri.parse(geturi);