English 中文(简体)
b) 采用某种方法。
原标题:Bind to Service and execute some methods?

据我所知,当你对遥远的<条码>服务<>/代码”进行约束时,它就赢得了一定的约束,直到你从警示中返回。 我需要约束一项服务,并立即执行某种方法。 是否有办法? 我的法典希望:

try {
            Parser parser = FrameworkBridge.getFrameworkBridge(this).getParser();
            if (parser != null) {
                for (Article a : parser.getArticlesList("http://www.bt.dk/mecommobile/latest/news_article/%s/%s?output_type=xml", 1379, 20)) {
                    listAdapter.add(a);
                }
            }
        } catch (RemoteException e) {
            Log.d(TAG, "Service communication failure");
        } catch (FrameworkNotInstalledException e) {
            Log.d(TAG, "No framework installed. Install it!");
        }

此处FrameworkBridge.getFrameworkBridge (this).getParser() 履行所有服务连接日常和返回的远程接口。 问题在于——如果上述代码中的I m尚未实现连接,则<代码>parser为。 在退出法典之前,我怎么能够把它联系起来?

最佳回答

在服务公司(服务公司)接通和建立远程接口时,将告诉你。 Don t试图将任何服务方法称作服务,直至启动。

问题回答
mContext.bindService( new Intent("name of the class"), this, Context.BIND_AUTO_CREATE);

采用上述方法,需要时,应当自动对服务进行约束。 我不相信100%,但这应当有助于你略微走出来。





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签