小编Bha*_*shu的帖子

无法构建GCM演示服务器应用程序

每当我尝试使用文档构建GCM演示服务器时ant,我会得到17个编译错误.似乎缺少一些GCM库.我该如何解决这些问题?

 Errors:

  Buildfile: build.xml

init:

compile:
    [javac] Compiling 7 source files to /root/gcm/samples/gcm-demo-server/build/classes
    [javac] /root/gcm/samples/gcm-demo-server/src/com/google/android/gcm/demo/server/SendAllMessagesServlet.java:18: package com.google.android.gcm.server does not exist
    [javac] import com.google.android.gcm.server.Constants;
    [javac]                                     ^
    [javac] /root/gcm/samples/gcm-demo-server/src/com/google/android/gcm/demo/server/SendAllMessagesServlet.java:19: package com.google.android.gcm.server does not exist
    [javac] import com.google.android.gcm.server.Message;
    [javac]                                     ^
    [javac] /root/gcm/samples/gcm-demo-server/src/com/google/android/gcm/demo/server/SendAllMessagesServlet.java:20: package com.google.android.gcm.server does not exist
    [javac] import com.google.android.gcm.server.MulticastResult;
    [javac]                                     ^
    [javac] /root/gcm/samples/gcm-demo-server/src/com/google/android/gcm/demo/server/SendAllMessagesServlet.java:21: package com.google.android.gcm.server does not exist
    [javac] import com.google.android.gcm.server.Result;
    [javac]                                     ^
    [javac] /root/gcm/samples/gcm-demo-server/src/com/google/android/gcm/demo/server/SendAllMessagesServlet.java:22: package com.google.android.gcm.server does not exist
    [javac] import com.google.android.gcm.server.Sender;
    [javac]                                     ^
    [javac] /root/gcm/samples/gcm-demo-server/src/com/google/android/gcm/demo/server/SendAllMessagesServlet.java:46: cannot …
Run Code Online (Sandbox Code Playgroud)

java ant android google-cloud-messaging

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

如何在 Qt C++ 中根据主题更改图标?如果可用的主题是深色或浅色

我有一个基于 Qt 的文本编辑器程序。它的默认主题是黑暗的。我想添加一个功能,当用户为 switchtheme() 选择 QAction 时,主题应该切换为亮,图标也应该根据亮/暗而变化。在我的 qrc 文件中,我设置了如下结构

:/images
|--> /theme_dark/
|--> /theme_light/ 
Run Code Online (Sandbox Code Playgroud)

两个目录中的图标文件名都保持相同。

void MainWindow::switchTheme(const QString &themeName) 
{
//themeName will be "light" or "dark"

    QString image_path = ":/images/theme_"+themeName+"/"; 

    //Now maybe we can create a QStringList and append(filenames) to it.
    //Find all QActions in the toolbar and setIcon()?
}
Run Code Online (Sandbox Code Playgroud)

问题是深色图标在深色主题上不好看,浅色图标在浅色主题上不好看。我想知道如何以有效的方式做到这一点。

c++ qt

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

如何在不同的包中调用类的私有方法

BookView.class有一个私有方法,如下所示

  public class BookView{
    private boolean importBook(String epubBookPath){
    //The function that adds books to database.
    }
  }
Run Code Online (Sandbox Code Playgroud)

我试图从另一个包中调用此函数.我的代码是

    protected void onPostExecute(String file_url) {
        // dismiss the dialog after the file was downloaded
        dismissDialog(progress_bar_type);

        /*Now we add the book information to the sqlite file.*/
        TextView textView=(TextView)findViewById(R.id.textView1);
        String filename = textView.getText().toString();
        String baseDir = Environment.getExternalStorageDirectory().getAbsolutePath();
        String epubBookPath = baseDir+filename;
        Log.i("epubBookPath:",epubBookPath); //No errors till here!

        try {
            Method m=BookView.class.getDeclaredMethod("importBook");
            m.setAccessible(true);//Abracadabra 
            //I need help from here! How do i pass the epubBookPath to the …
Run Code Online (Sandbox Code Playgroud)

java

0
推荐指数
2
解决办法
3603
查看次数

标签 统计

java ×2

android ×1

ant ×1

c++ ×1

google-cloud-messaging ×1

qt ×1