小编p.a*_*xey的帖子

无需打印服务预览即可打印

我想在我的应用程序中按下按钮并将 pdf 文档发送到打印机直接打印(不显示来自打印框架 Android 4.4 的系统 android 预览)。我该怎么做?我试图通过 Socket 连接到打印机。没关系,无一例外,但我的打印机没有响应,也没有打印任何内容。

也许我需要在手机上为混凝土打印机设置驱动程序?但是怎么做,我在哪里可以得到这样的驱动程序?

已编辑

在此处输入图片说明

java printing android android-print-framework

4
推荐指数
1
解决办法
2221
查看次数

google-services.json 找不到与任何模块的包名称匹配的客户端

我将应用程序中的应用模块重命名为演示模块。

  • 我把 google-services.json 放在我的演示文稿中/
  • 添加 classpath "com.google.gms:google-services:3.1.0"
  • 添加了插件: apply plugin: 'com.google.gms.google-services'

当我尝试同步 gradle 时,出现错误:

Error:Execution failed for task ':presentation:processDebugGoogleServices'.
No matching client found for package name 'ru.company.acitive.activelife'
Run Code Online (Sandbox Code Playgroud)

我的 build.gradle 片段:

dependencies {
    classpath "com.android.tools.build:gradle:$android_plugin_version"
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    classpath "com.google.gms:google-services:3.1.0"
}
Run Code Online (Sandbox Code Playgroud)

我的presentation/build.gradle片段:

dependencies {

...

testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
apply plugin: 'com.google.gms.google-services'
Run Code Online (Sandbox Code Playgroud)

android firebase

3
推荐指数
1
解决办法
1万
查看次数

空对象引用上的 DialogFragment 'java.lang.String android.content.Context.getPackageName()'

我正在使用 DialogFragment 并使用 Volley 将数据插入 mysql。数据已成功插入数据库,但之后总是崩溃。我总是在 logcat java.lang.NullPointerException 中收到此错误:尝试在空对象引用上调用虚拟方法 'java.lang.String android.content.Context.getPackageName()' 错误出现在我的 Toast 中。请帮忙

public class ExpensesLeisureDialog extends DialogFragment {
EditText name, amount, details;
String nameHolder, amountHolder, detailsHolder;
Boolean CheckEditText;
RequestQueue requestQueue;

HashMap<String,String> hashMap = new HashMap<>();
String finalResult;
HttpParse httpParse = new HttpParse();
String HttpURL = "http://10.0.2.2:63343/TheMoneyger/api/add-leisure.php";

@Override
public Dialog onCreateDialog (Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    LayoutInflater inflater = getActivity().getLayoutInflater();
    builder.setView(inflater.inflate(R.layout.fragment_add_expenses_dialog, null));
    requestQueue = Volley.newRequestQueue(getActivity().getApplicationContext());
    builder.setTitle("Add leisure expense")
            .setPositiveButton("Add", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface …
Run Code Online (Sandbox Code Playgroud)

java android

1
推荐指数
1
解决办法
4947
查看次数