Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public void onClick(View v)
- {
- String filePath = (String)v.getTag();
- File fileToView = new File(filePath);
- Intent viewIntent = new Intent(Intent.ACTION_VIEW);
- viewIntent.setData(Uri.fromFile(fileToView));
- final Intent chooserIntent = Intent.createChooser(viewIntent, "Choose an app to open this file:");
- startActivity(chooserIntent);
- }
- <activity
- android:name="YOUR_PICKED_ACTIVITY"
- android:launchMode="singleTask"
- android:screenOrientation="portrait"
- android:theme="@style/AppTheme"
- android:windowSoftInputMode="adjustResize">
- <intent-filter>
- <action android:name="android.intent.action.SEND" />
- <category android:name="android.intent.category.DEFAULT" />
- <data android:mimeType="*/*" //THIS IS THE TYPE OF YOUR FILE */* for any file />
- </intent-filter>
- </activity>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement