我正在尝试共享我在 pdfView 中打开的 pdf 文档。但由于某种原因,activityViewController 是空的,我无法在某处发送文件。请告诉我如何修复我的代码!
我的 ViewController 的代码
pdfView.swift
import UIKit
import PDFKit
var nameFile:String?
var titleChapter:String?
class pdfView: UIViewController {
@IBOutlet weak var pdfDocView: PDFView!
// Share doc
@IBAction func shareDocAction(_ sender: UIBarButtonItem) {
let path = Bundle.main.path(forResource: nameFile, ofType:"pdf")
let pdfDocument = PDFDocument(url: URL(fileURLWithPath: path!))
var filesToShare = [Any]()
filesToShare.append(pdfDocument!)
let activityViewController = UIActivityViewController(activityItems: filesToShare , applicationActivities: nil)
activityViewController.popoverPresentationController?.sourceView = self.view
present(activityViewController, animated: true, completion: nil)
}
//Pdf view
override func viewDidLoad() {
super.viewDidLoad()
self.navigationItem.title = titleChapter …Run Code Online (Sandbox Code Playgroud) 我的网站上有一个“分享到 Linkedin”按钮。它基本上只是一个链接,在桌面上运行良好。这是链接:
https://www.linkedin.com/sharing/share-offsite/?url= {我的网址}
但是,这在移动设备上不起作用。如果我尝试在手机 (iOS) 上分享我的网站,它会打开 Linkedin 应用程序,但仅此而已。它不会打开后对话框或任何东西。
我如何才能在移动设备上实现此功能?
我尝试从 android/data/mypackage/files/file.pdf 共享 pdf 文件我也在这个应用程序中生成这些 pdf,当我尝试共享它时,pdf 没有出现在电子邮件的附件中,或者谷歌驱动器说:“没有数据共享”。这是我分享pdf的代码:
val aName = intent.getStringExtra("iName")
val file = File(this.getExternalFilesDir(null)?.absolutePath.toString(), "$aName")
val shareIntent = Intent(Intent.ACTION_SEND)
shareIntent.putExtra(Intent.EXTRA_STREAM, file)
shareIntent.flags = Intent.FLAG_GRANT_READ_URI_PERMISSION
shareIntent.type = "application/pdf"
startActivity(Intent.createChooser(shareIntent, "share.."))
Toast.makeText(this,"$file",Toast.LENGTH_SHORT).show()
Run Code Online (Sandbox Code Playgroud)
我正在开发一个跨平台的OpenGL项目,当我尝试在Windows中加载它们时,共享GLcontext的所有纹理似乎都有问题.我被告知在Windows上的旧版OpenGL中不支持这一点,但似乎必须有一些方法在Windows上分享OpenGL中的纹理资源.如果没有办法在windows上的opengl中的多个对象之间共享纹理,这对某些应用程序来说是一个难以忍受的瓶颈,所以我认为现在必须克服这个限制.
我正在将程序移植到Android.我在POJO上拥有所有业务逻辑,所以我需要将Activities用作前端.
问题是我不知道如何在活动之间共享POJO; 我试过这个,但它不起作用:
class Activity1 extends Activity{
Logic logic=new Logic();
public Logic getLogic(){
return logic
}
}
class Activity2 extends Activity{
Logic logic;
public void onCreate(Bundle savedInstanceState) {
main = (Activity1) findViewById((R.id.Activity1);
logic= main.getLogic();
}
}
Run Code Online (Sandbox Code Playgroud)
请注意,POJO不用于共享数据,它实际上包含业务逻辑.
我在很多应用程序中看到了..当你点击一个菜单,而不是其他菜单出现,你可以通过电子邮件,推特,蓝牙,脸书等分享你的应用程序.
我怎样才能做到这一点?
我正在制作一个应用程序,我需要在Facebook时间轴上与文本共享图像.然而,使用我的代码,我可以共享Facebook墙的链接,但不能共享图像.我已经尝试了大部分堆栈溢出代码.但还没有成功.这是我的代码.
MainActivity.java
package com.example.test2;
import com.facebook.android.Facebook;
import android.net.Uri;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Spinner;
import android.widget.Toast;
Run Code Online (Sandbox Code Playgroud)
公共类MainActivity扩展Activity {
String[] ShareOption;
Spinner ShareOptionList;
int driverStarScore = 1; //2 or 3 ...
Facebook facebookClient;
SharedPreferences mPrefs;
ListView list;
String[] ShareItemName ={
"Dropbox",
"Email",
"Facebook",
"Google Plus",
"Twitter",
"Whatsapp",
};
Integer[] ShareImageId={
R.drawable.ic_dropbox,
R.drawable.ic_email,
R.drawable.ic_facebook,
R.drawable.ic_googleplus,
R.drawable.ic_twitter,
R.drawable.ic_whatsapp,
};
@Override
public void onCreate(Bundle …Run Code Online (Sandbox Code Playgroud) 我有一个小工具,上面有社交媒体分享按钮.按钮的API需要很长时间才能加载,标签有一个旋转图标,按钮可见但不可用.这显然很糟糕.
我现在使用下面的小脚本在页面加载后加载API,我想保留.
<script>
// Load the share API's once the entire page is loaded.
$(window).bind("load", function() {
$.getScript('js/share.js', function() {});
});
</script>
Run Code Online (Sandbox Code Playgroud)
但是我也想隐藏社交媒体按钮div,直到脚本中的API被加载,我该如何实现呢?
我有一些应用程序的捆绑名称,所以现在我需要生成所有应用程序的apks并希望使用共享意图发送.
我尝试了很多可能的解决方案,但没有找到任何方法
我使用此链接,但没有工作包装我的应用程序,并分享给其他+ android
提前致谢