在Laravel应用程序中,我正在尝试在视图内部实现一个按钮,允许用户下载文件而无需导航到任何其他视图或路径现在我有两个问题:(1)下面的函数抛出
The file "/public/download/info.pdf" does not exist
Run Code Online (Sandbox Code Playgroud)
(2)下载按钮不应该将用户导航到任何地方而只是在同一视图下载文件,我当前的设置,将视图路由到'/ download'
以下是我试图实现的方法:
按钮:
<a href="/download" class="btn btn-large pull-right"><i class="icon-download-alt"> </i> Download Brochure </a>
Run Code Online (Sandbox Code Playgroud)
路线:
Route::get('/download', 'HomeController@getDownload');
Run Code Online (Sandbox Code Playgroud)
控制器:
public function getDownload(){
//PDF file is stored under project/public/download/info.pdf
$file="./download/info.pdf";
return Response::download($file);
}
Run Code Online (Sandbox Code Playgroud) 我添加MUPDF到Android应用程序做:
(1) http://mupdf.blogspot.com/
(2) http://pastebin.com/YzHUhzE7
当我尝试做的时候:
Intent intent = new Intent(getBaseContext(), ChoosePDFActivity.class);
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)
我明白了:
07-19 05:22:37.255: W/dalvikvm(16084): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcom/artifex/mupdfdemo/MuPDFCore;
07-19 05:22:37.255: D/AndroidRuntime(16084): Shutting down VM
07-19 05:22:37.255: W/dalvikvm(16084): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
07-19 05:22:37.275: E/AndroidRuntime(16084): FATAL EXCEPTION: main
07-19 05:22:37.275: E/AndroidRuntime(16084): java.lang.ExceptionInInitializerError
07-19 05:22:37.275: E/AndroidRuntime(16084): at com.artifex.mupdfdemo.MuPDFActivity.openFile(MuPDFActivity.java:212)
07-19 05:22:37.275: E/AndroidRuntime(16084): at com.artifex.mupdfdemo.MuPDFActivity.onCreate(MuPDFActivity.java:311)
07-19 05:22:37.275: E/AndroidRuntime(16084): at android.app.Activity.performCreate(Activity.java:5104)
07-19 05:22:37.275: E/AndroidRuntime(16084): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
07-19 05:22:37.275: E/AndroidRuntime(16084): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
07-19 05:22:37.275: E/AndroidRuntime(16084): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
07-19 …Run Code Online (Sandbox Code Playgroud) 在我现有的Android应用程序中,我使用MuPDF,我在这个文档的帮助下移植. 现在,当我想在活动中打开pdf文件时,我使用:Uri uri = Uri.parse(path);
Intent intent = new Intent(this, MuPDFActivity.class);
intent.setAction(Intent.ACTION_VIEW);
intent.setData(uri);
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)
这是一个新的活动,我的问题是:(1)我怎样才能开始片段查看pdf?(2)MuPDF是否支持我可以在我的currant Android-Tab-View下调用的片段?(3)有没有办法将此活动转换为片段?
目前我在做:
public class DummySectionFragment extends Fragment {
public DummySectionFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = null;
rootView = inflater.inflate(R.layout.activity_dummy_section_fragment, container, false);
Intent myIntent = new Intent(getActivity(), MuPDFActivity.class);
myIntent.setAction(Intent.ACTION_VIEW);
myIntent.setData(uri);
getActivity().startActivity(myIntent);
return rootView;
}
}
Run Code Online (Sandbox Code Playgroud)
其中:在我当前的选项卡视图布局上打开一个新活动,这看起来不太好,因为它涵盖整个选项卡布局,用户必须单击BACK按钮才能查看选项卡视图.
我想将数据保存到firebase多子节点:
--Events
----Races
-------Participants
Run Code Online (Sandbox Code Playgroud)
这是一个虚拟数据,这是我想要保存到firebase的一种数据
var dummyData = [
{
event_id: 1,
event_venue: "Churchill Ground Venue",
event_name: "Victoria Cup",
event_type: "Holiday Special",
event_datetime: now,
event_url: 'www',
races: {
1: {
race_id: 1,
race_type: "Horse Race",
race_url: "www",
race_name: "Super Hourse 8",
race_venue: "Ground No 7",
race_datetime: now,
races_participants: {
1: {
participants_id: 1211,
participants_name: "Doll Fire",
participants_place_odds: 10,
participants_win_odds: 5,
participants_result: 0,
}
}
},
2: {
race_id: 2,
race_type: "Horse Race 2",
race_url: "www",
race_name: "Super Hourse 9",
race_venue: …Run Code Online (Sandbox Code Playgroud) 在我的离子 Cordova 应用程序中,我使用应用内购买插件:https : //github.com/j3k0/cordova-plugin-purchase
这是我用来初始化存储的方法:
storekit.init({
debug: true, // Enable IAP messages on the console
ready: service.IAP.onReady,
purchase: service.IAP.onPurchase,
restore: service.IAP.onRestore,
error: service.IAP.onError
});
Run Code Online (Sandbox Code Playgroud)
此初始化在 iOS 上运行良好,所有产品也可以正常加载,但 Android 设备在购买时无法加载。
我猜,对于 android 有不同的初始化方法。
我在应用程序中添加了插件:
cordova plugin add cc.fovea.cordova.purchase --variable BILLING_KEY="<BILLING_KEY>"
Run Code Online (Sandbox Code Playgroud)
请帮忙。
我正试图在我的应用程序中解析json:
所以首先我为我的Android应用程序创建了常量类,它为app.config提供了大约6个变量:
(等级:1)
public class Constants{
// url to make request
public static String url = "http://server.com/";
// JSON Node names
public static final String TAG_CONTACTS = "contacts";
public static final String TAG_ID = "id";
public static final String TAG_NAME = "name";
public static final String TAG_EMAIL = "email";
public static final String TAG_ADDRESS = "address";
public static final String TAG_GENDER = "gender";
}
Run Code Online (Sandbox Code Playgroud)
现在我想在不同的类中使用它,所以我继续创建了不同的类:
(等级:2)
public class ReadFiles{
public void readConstant(){
//appConfig is JSONArray
JSONArray appConfig = null;
// …Run Code Online (Sandbox Code Playgroud) android ×4
angularjs ×2
java ×2
mupdf ×2
android-view ×1
angularfire ×1
cordova ×1
firebase ×1
ionic ×1
javascript ×1
laravel ×1
laravel-4 ×1
performance ×1
php ×1