现在我的代码打开了默认的下载视图,它只显示我下载的PDF.我选择了一个PDF文件,我得到了这个:
内容://com.android.providers.downloads.documents/document/1171
我想得到这个:
/storage/emulated/0/Download/ch22Databases.pdf
我的问题是如何在Android中执行此操作?
我的代码:
public void PDF() {
PDF = (Button) findViewById(R.id.FindPDFBtn);//Finds the button in design and put it into a button variable.
PDF.setOnClickListener(//Listens for a button click.
new View.OnClickListener() {//Creates a new click listener.
@Override
public void onClick(View v) {//does what ever code is in here when the button is clicked
Intent intent = new Intent();
intent.setType("application/pdf");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Select a PDF "), SELECT_PDF);
}
}
);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) …
Run Code Online (Sandbox Code Playgroud) 我想在我的应用中制作一个简单的通知功能.我按照此 YouTube视频和这两个Firebase文档网址1和2以及Android Studio中的Firebase工具助手(说我已连接到Firebase).出于某种原因,在我的旧应用程序(下面发布的代码)上执行这些步骤和文档后,它将不允许我接收通知.但是,如果我在一个全新的应用程序上执行相同的步骤,它将完美地运行.我在后台,活动和终止状态下测试了同一物理设备和环境中的两个应用程序.每次我创建的新演示应用程序都没有问题,但我想要通知的旧应用程序不起作用.两者均未经过设备ID测试.我甚至没有得到任何错误日志或任何TAG日志.我认为我的一个编译项目是干扰的,不确定究竟是什么,但我可能要看那里.
PS.我在下面删除了我的包名,我在FireBase上多次检查并且它们匹配,所以我知道这不是问题.但是,我的新演示应用程序的FireBase显示我的应用程序连接但我的旧应用程序的FireBase没有.此外,我之前已经设置了赏金,但仍然遇到同样的问题.
这是我有问题的代码:
Notification.java(它的文档要求的服务)
public class Notification extends FirebaseMessagingService {
public Notification() {
}
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
showNotification(remoteMessage.getData().get("message"));
Log.d("FMC", "Message Notification Body: " + remoteMessage.getNotification().getBody());
}
private void showNotification(String message) {
Intent i=new Intent(this, SplashScreen.class);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingIntent=PendingIntent.getActivity(this,0,i,PendingIntent.FLAG_UPDATE_CURRENT);
NotificationCompat.Builder builder=new NotificationCompat.Builder(this)
.setAutoCancel(true)
.setContentTitle("FCM TITLE").setContentText(message)
.setSmallIcon(R.drawable.pt_icon)
.setDefaults(android.app.Notification.DEFAULT_ALL)
.setContentIntent(pendingIntent);
NotificationManager notificationManager= (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
notificationManager.notify(0,builder.build());
}
}
Run Code Online (Sandbox Code Playgroud)
请注意,我甚至没有在上面的notification.java中登录.
Project.gradle
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/' …
Run Code Online (Sandbox Code Playgroud) 所以我将Xcode和GitHub项目代码升级到swift 3.0(我的项目在Obj C中,我在GitHub中使用的一些pod都在Swift中).我收到了一些错误,现在我被困在这些错误上了.出于某种原因,我的floatingSctionButton(git here)的dataSource和delegate 现在不起作用.我尝试设置dataSource
和delegate
编程和故事板,但它没有工作.
错误:
在'LiquidFloatingActionButton*'类型的对象上找不到属性'dataSource'
在'LiquidFloatingActionButton*'类型的对象上找不到属性'委托'
我相信,如果我弄清楚dataSource
并delegate
发出问题,那么它将修复下面的颜色错误.
.H:
#import <UIKit/UIKit.h>
#import "ProductContentViewController.h"
#import "LiquidFloatingActionButton-swift.h"
@interface SetScreenViewController : UIViewController
<UIPageViewControllerDataSource, LiquidFloatingActionButtonDelegate, LiquidFloatingActionButtonDataSource>
...
@end
Run Code Online (Sandbox Code Playgroud)
.M:
#import "LiquidFloatingActionButton-Swift.h"
LiquidFloatingActionButton *floatingActionButton;
NSMutableArray *liquidCells;
bool *closeFloatingButtons;
NSString *videoToWatchURL;
- (void)addLiquidButton{
//Grabs the coordinates bottom right of the screen
float X_Co = self.view.frame.size.width - 50;
float Y_Co = self.view.frame.size.height - 50;
//i subtract 10 so the button will be placed a little …
Run Code Online (Sandbox Code Playgroud) 当用户登录时,我想从那里的帐户回显 ID(由于 phpMyAdmin 中的 auto_increment 而创建),这是我的 login.PHP:
<?php
$conn = mysqli_connect("xxxxxx", "xxxxx", "xxxx", "BuyerAccounts");
$Email = $_POST["Email"];
$Password = $_POST["Password"];
$sql_query = "select Buyer_Email from user_info where Buyer_Email like '$Email' and Buyer_Password like '$Password';";
$result = mysqli_query($conn, $sql_query);
if(mysqli_num_rows($result) > 0 ){
$row = mysqli_fetch_assoc($result);
$name = $row["Buyer_Email"];
echo "Welcome: Buyer";
}else{
$int = 1;
//echo "Buyer login failed...";
}
}else{
echo "Login failed...";
}
}
mysqli_stmt_close($statement);
mysqli_close($conn);
?>
Run Code Online (Sandbox Code Playgroud)