我之前使用过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) 我已经下载了Algebird,我想使用这个库在Scala解释器中尝试一些东西.我该如何实现这一目标?
我想知道在哪个提交中添加了下面给出的代码:
if (getListView().getChildCount() == 0)
getActivity().findViewById(android.R.id.empty).setVisibility(View.VISIBLE);
Run Code Online (Sandbox Code Playgroud)
我该如何实现这一目标?
我正在开发一个使用标签实现的应用程序FragmentActivity.因为整个应用程序都需要选项卡,所以片段被广泛用于使应用程序在所有版本的android上兼容.
因此,我在可视化方面遇到了一个问题,即背板上存在哪些碎片.我确信有一种方法可以检索backstack上存在的片段列表.谢谢.
我的场景:活动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替换.事实上,这两个片段都是可见的.我该如何解决这个问题?
我正在尝试获取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应用程序" XYZ ",用户将在其中存储图像和视频等媒体.因此,我想在Android库中创建一个名为"XYZ"的文件夹,并将所有特定于该应用程序的媒体存储在"XYZ"中.我该如何实现?
目前,我能够将媒体存储在SD卡上并扫描媒体文件,它们显示在android图库的"images"文件夹中.
我用它创建了一个maven项目maven-archetype-quickstart.我已经开始编码了,现在我想改变原型,maven-archetype-webapp以使其成为一个动态的Web项目.我该如何实现这一目标?
我正在尝试使用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) 我正在尝试使用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 ×6
back-stack ×2
caching ×1
eclipse ×1
galaxy-tab ×1
git ×1
git-commit ×1
http-post ×1
httprequest ×1
httpresponse ×1
interpreter ×1
java ×1
json ×1
m2eclipse ×1
maven ×1
scala ×1
searchview ×1
tabs ×1