karthi
karthi

Reputation: 1423

Android show intent in Dialog

I am new to Android application development and I want to show an Intent as Dialog. How can I do this?

Intent intent = new Intent(android.content.Intent.ACTION_VIEW);

I want to show this on dialog. Please suggest me.

Upvotes: 0

Views: 2567

Answers (2)

Aparna Suresh
Aparna Suresh

Reputation: 415

Give android:style/Theme.Dialog in the corresponding activity in the manifest file.

Upvotes: 1

Jeeva
Jeeva

Reputation: 1155

Try this,

Intent intent = new Intent();  
intent.setAction(android.content.Intent.ACTION_VIEW);  
File file = new File("/sdcard/test.mp4");  
intent.setDataAndType(Uri.fromFile(file), "video/*");  
startActivity(intent);   

Intent intent = new Intent();  
intent.setAction(android.content.Intent.ACTION_VIEW);  
File file = new File("/sdcard/test.mp3");  
intent.setDataAndType(Uri.fromFile(file), "audio/*");  
startActivity(intent);

Upvotes: 1

Related Questions