Basic understandings of Android Intents and starting activity from it..
....................................................................................................................
Toast and its simplest work to show the text:
Toast.maketext(getActivity(),textview.getText().toString(),Toast.LENGTH_SHORT).show();
Starting Activity:
>startActivity(i); //if i is a defined Intent object already;
>startActivity(new Intent("name of the class from manifest.xml");
>startActivity(new Intent(this, "name of the java class");
Intents in Android and its invocations
1>Intent i = new Intent(android.content.Intent.ACTION_VIEW,Uri.parse("http://website"));
startActivity(i);
2> Intent i = new Intent(android.content.Intent.ACTION_VIEW);
i.setData(Uri.parse("http://website"));
startActivity(i);
****************
Uri.parse can take values as such to be shown:
Like :>
geo---for map application or activity;
tel--->for telephonic activity
http-->for web browser activity
****************
3>For default action or dynamic data:
Intent i = new Intent(android.content.Intent.ACTION_PICK);
i.setType(ContactsContract.Contacts.CONTENT_TYPE);
startActivity(i);
Intent can contain the following information:
>Action
>Data
>Type
>Category
>To choose from options..
add:
> category in the manifest file:
eg. and
add in the main java file
as
Intent i = new Intent(android.content.Intent.ACTION_VIEW,Uri.parse("http://webaddress"));
startActivity(Intent.createChooser(i,"choose");
....................................................................................................................
Toast and its simplest work to show the text:
Toast.maketext(getActivity(),textview.getText().toString(),Toast.LENGTH_SHORT).show();
Starting Activity:
>startActivity(i); //if i is a defined Intent object already;
>startActivity(new Intent("name of the class from manifest.xml");
>startActivity(new Intent(this, "name of the java class");
Intents in Android and its invocations
1>Intent i = new Intent(android.content.Intent.ACTION_VIEW,Uri.parse("http://website"));
startActivity(i);
2> Intent i = new Intent(android.content.Intent.ACTION_VIEW);
i.setData(Uri.parse("http://website"));
startActivity(i);
****************
Uri.parse can take values as such to be shown:
Like :>
geo---for map application or activity;
tel--->for telephonic activity
http-->for web browser activity
****************
3>For default action or dynamic data:
Intent i = new Intent(android.content.Intent.ACTION_PICK);
i.setType(ContactsContract.Contacts.CONTENT_TYPE);
startActivity(i);
Intent can contain the following information:
>Action
>Data
>Type
>Category
>To choose from options..
add:
> category in the manifest file:
eg.
add in the main java file
as
Intent i = new Intent(android.content.Intent.ACTION_VIEW,Uri.parse("http://webaddress"));
startActivity(Intent.createChooser(i,"choose");
No comments:
Post a Comment