开发者

Handler is not calling in service?

I am calling Handler from CallBack method, method is,

public void callback(String fileName) {
        Log.d("Callback", "In call back method");
        System.out.println("--File = " + fileName);
        File d = new File(fileName);

        if (d.isDirectory()) {
            System.out.println("Is a directory ");
        } else {
            System.out.println("is a file");
            Bundle data = new Bundle();
            data.putString("path", fileName);
            Message msg = new Message();
            msg.setData(data);

           mfileObserver.sendMessage(msg);
            // mfileObserver.sendEmptyMessage(10);
            System.out.println("--msg is = " + msg);
            System.out.println("--File = " + fileName);
            //showDialog(fileName);

        }

I want call activity throught handler,here i am passing file path to activity.My handler code is,

mfileObserver = new Handler() {
            public void handleMessage(Message msg) {
                 if (msg.what == 10) {
                final Bundle msgData = msg.getData();
 开发者_运维问答               Log.d("FileObserverTest",
                        "handler " + msgData.getString("path"));
                System.out.println("in handler----- = ");
                System.out.println("path is----- = " + msgData.getString("path"));
                showDialog(msgData.getString("path"));

                // some(msgData.getString("path"));
                 }
            }
        };

plz help me.


Intent dialogIntent = new Intent(this, CachingActivity.class);
Bundle bundle = new Bundle();
bundle.putInt("something", someInt);
dialogIntent .putExtras(bundle);
dialogIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
getApplication().startActivity(dialogIntent);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜