小编Har*_*iya的帖子

为什么hierarchyviewer不适用于三星Galaxy TAB 7.0?

我之前使用过hierarachyviewer,但在android模拟器上.当我在模拟器上使用它时,它工作得非常好.但是它不适用于搭载Android 2.3.4的三星Galaxy TAB 7.0.

这是我得到的日志

11:04:22 E/hierarchyviewer: Unable to get view server version from device 303599
64881B00EC
11:04:22 E/hierarchyviewer: Unable to get view server protocol version from devi
ce 30359964881B00EC
11:04:24 E/hierarchyviewer: Unable to debug device 30359964881B00EC
11:05:05 E/hierarchyviewer: Unable to get view server version from device 303599
64881B00EC
11:05:05 E/hierarchyviewer: Unable to get view server protocol version from devi
ce 30359964881B00EC
11:05:07 E/hierarchyviewer: Unable to debug device 30359964881B00EC
11:09:38 E/hierarchyviewer: Unable to get view server version from device 303599 …
Run Code Online (Sandbox Code Playgroud)

android galaxy-tab

70
推荐指数
5
解决办法
5万
查看次数

如何使用Scala REPL的第三方库?

我已经下载了Algebird,我想使用这个库在Scala解释器中尝试一些东西.我该如何实现这一目标?

interpreter scala read-eval-print-loop

68
推荐指数
4
解决办法
2万
查看次数

如何找出添加特定代码的提交?

我想知道在哪个提交中添加了下面给出的代码:

if (getListView().getChildCount() == 0)
                getActivity().findViewById(android.R.id.empty).setVisibility(View.VISIBLE);
Run Code Online (Sandbox Code Playgroud)

我该如何实现这一目标?

git git-commit

56
推荐指数
4
解决办法
2万
查看次数

如何获取android中的backstack片段条目列表?

我正在开发一个使用标签实现的应用程序FragmentActivity.因为整个应用程序都需要选项卡,所以片段被广泛用于使应用程序在所有版本的android上兼容.

因此,我在可视化方面遇到了一个问题,即背板上存在哪些碎片.我确信有一种方法可以检索backstack上存在的片段列表.谢谢.

tabs android android-fragments back-stack

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

按下后退按钮时如何用片段A替换片段C?

我的场景:活动1由碎片A-> B-> C组成.使用以下代码添加所有碎片:

        FragmentManager fm = getSupportFragmentManager();
        FragmentTransaction ft = fm.beginTransaction();
        ft.replace(R.id.content, fragment, TAG);
        ft.addToBackStack(TAG);
        ft.commit();
Run Code Online (Sandbox Code Playgroud)

现在,从片段C开始,我想直接返回片段A.因此,我ft.addToBackStack(TAG)在添加片段C时进行了评论.因此,当我从CI按下后退按钮时,直接在屏幕上显示片段A.

但是,片段C不会被A替换.事实上,这两个片段都是可见的.我该如何解决这个问题?

android android-fragments back-stack fragmenttransaction

34
推荐指数
2
解决办法
4万
查看次数

Android:getSearchableInfo(getComponentName())返回null?

我正在尝试获取SearchView的建议.我为它实现了一个自定义内容提供程序.我也提到了这个链接来实现SearchView的建议.我面临的问题是,我得到空值searchManager.getSearchableInfo(getComponentName())

以下是片段:

AndroidManifest.xml中

    <application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >

    <provider android:name=".SearchProvider"
        android:enabled="true"
        android:authorities="com.example.currentlocationmapdemo"
        android:grantUriPermissions="true"
        android:exported="true">
        <grant-uri-permission android:pathPattern="*" />
    </provider>
    <uses-library android:name="com.google.android.maps" />

    <activity
        android:name=".MainActivity"
        android:label="@string/title_activity_main" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      <meta-data android:name="android.app.searchable"
          android:resource="@xml/searchable"/> 
    </activity>
Run Code Online (Sandbox Code Playgroud)

searchable.xml

<?xml version="1.0" encoding="utf-8"?>
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:label="label"
android:hint="hint"
android:searchSuggestAuthority="com.example.currentlocationmapdemo"
android:searchSuggestSelection=" ? ">
Run Code Online (Sandbox Code Playgroud)

主要活动

    @Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.searchview_in_menu, menu);
    MenuItem searchItem = menu.findItem(R.id.action_search);
    mSearchView = (SearchView) searchItem.getActionView();
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
SearchableInfo info …
Run Code Online (Sandbox Code Playgroud)

android android-searchmanager search-suggestion searchview

12
推荐指数
2
解决办法
9059
查看次数

如何在android gallery中创建应用程序特定的文件夹?

我正在构建Android应用程序" XYZ ",用户将在其中存储图像和视频等媒体.因此,我想在Android库中创建一个名为"XYZ"的文件夹,并将所有特定于该应用程序的媒体存储在"XYZ"中.我该如何实现?

目前,我能够将媒体存储在SD卡上并扫描媒体文件,它们显示在android图库的"images"文件夹中.

android android-gallery

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

在eclipse中创建项目后更改Maven Archetype?

我用它创建了一个maven项目maven-archetype-quickstart.我已经开始编码了,现在我想改变原型,maven-archetype-webapp以使其成为一个动态的Web项目.我该如何实现这一目标?

eclipse m2eclipse maven maven-archetype

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

无法在java中使用cachingHttpClient缓存HttpResponse?

我正在尝试使用cachingHttpClient缓存HTTP响应,但是徒劳无功.这是我通过参考这个链接放在一起的演示,http://hc.apache.org/httpcomponents-client-ga/tutorial/html/caching.html

  public class CacheDemo {

    public static void main(String[] args) {
        CacheConfig cacheConfig = new CacheConfig();
        cacheConfig.setMaxCacheEntries(1000);
        cacheConfig.setMaxObjectSizeBytes(1024 * 1024);

        HttpClient cachingClient = new CachingHttpClient(new DefaultHttpClient(), cacheConfig);

        HttpContext localContext = new BasicHttpContext();

        sendRequest(cachingClient, localContext);
        CacheResponseStatus responseStatus = (CacheResponseStatus) localContext.getAttribute(
                CachingHttpClient.CACHE_RESPONSE_STATUS);
        checkResponse(responseStatus);


        sendRequest(cachingClient, localContext);
        responseStatus = (CacheResponseStatus) localContext.getAttribute(
                CachingHttpClient.CACHE_RESPONSE_STATUS);
        checkResponse(responseStatus);
    }

    static void sendRequest(HttpClient cachingClient, HttpContext localContext) {
        HttpGet httpget = new HttpGet("http://www.mydomain.com/content/");
        HttpResponse response = null;
        try {
            response = cachingClient.execute(httpget, localContext);
        } catch (ClientProtocolException e1) {
            // TODO …
Run Code Online (Sandbox Code Playgroud)

java caching httpresponse

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

如何使用google api客户端库为java发送带有JSON数据的POST请求?

我正在尝试使用google api客户端库发送帖子请求,但无法成功.

这是我正在使用的片段

UrlEncodedContent urlEncodedContent = new UrlEncodedContent(paramMap);   //paramMap contains email and password keypairs
HttpRequest request = httpRequestFactory.buildPostRequest(new GenericUrl(Constants.PHP_SERVICE_BASE_PATH + mPath) , urlEncodedContent);
String response = request.execute().parseAsString();
Run Code Online (Sandbox Code Playgroud)

我没有得到预期的回应.我认为这是因为邮政参数,即电子邮件和密码没有以正确的格式发送.我需要用JSON发送它们.

注意:我没有将该库用于Google Web服务.

android json http-post httprequest google-api-java-client

5
推荐指数
2
解决办法
7252
查看次数