Questions tagged «android»

Android是Google的移动操作系统,用于对数字设备(智能手机,平板电脑,汽车,电视,Wear,Glass和IoT)进行编程或开发。对于与Android相关的主题,请使用特定于Android的标签,例如android-intent,android-activity,android-adapter等。对于与开发或编程无关但与Android框架相关的问题,请使用以下链接:https:// android.stackexchange.com。

5
如何使用AutoCompleteTextView并使用来自Web API的数据填充它?
我想AutoCompleteTextView在活动中使用,并通过查询Web API随用户类型填充数据。我该怎么做呢? 是否创建新的类并覆盖AutoCompleteTextView.performFiltering,还是使用自定义列表适配器并提供android.widget.Filter覆盖performFiltering的自定义? 还是有更好的方法来达到我的最终目标? 我做了一些类似的事情,但这是针对“快速搜索”框的,它涉及实现服务,但是我认为这不是我想在这里做的。

12
构建Android UI的简便方法?[关闭]
关闭。此问题不符合堆栈溢出准则。它当前不接受答案。 想改善这个问题吗?更新问题,使其成为Stack Overflow的主题。 6年前关闭。 改善这个问题 是否有工具或网站可以帮助我使用拖放功能为Android应用程序创建UI? 我找到了这个网站,但想知道是否有更稳定的工具或网站吗?

8
需要实现Virgil Dobjanschi REST实现模式的示例Android REST Client项目
我想在Android手机上构建REST客户端。 REST服务器公开了多个资源,例如(GET) http://foo.bar/customer List of all customer http://foo.bar/customer/4711 The customer with id 4711 http://foo.bar/customer/vip List of all VIP customer http://foo.bar/company List of all companys http://foo.bar/company/4711 The company with the ID 4711 http://foo.bar/company/vip List of all VIP companys 我(认为)我知道如何与REST服务器对话并获取所需的信息。我将使用这样的API实现REST Client类 public List<Customer> getCustomers(); public Customer getCustomer(final String id); public List<Customer> getVipCustomer(); …


5
如何通过BLE(蓝牙低功耗)将Android设备连接到iOS设备
我正在尝试制作一个使用Android新的Bluetooth Low Energy API的应用程序。为此,我从API级别18附带的BLE示例开始。 当我读到Android无法充当外围设备时,我将Android手机置于中央模式,并在其周围扫描BLE设备。为此,我使用了模拟心脏传感器的Nordic平台进行了一些测试。一切都以完美的方式进行! 之后,我尝试选择一部iPhone(iOS 7 beta 4),并以外围方式放置它,并模拟心率传感器作为之前的测试。Android应用程序可以查看设备并连接到它。但是,连接处于活动状态后,两台设备会在3-4秒内彼此断开连接。除此之外,当我在Android端调用discoverServices()时,不会触发任何回调!在某些情况下,即使iOS蓝牙芯片已关闭,Android设备也会收到“已连接”事件。这很奇怪。为了证明这一点,我将北欧开发板置于中央模式,并且可以正确连接到iOS设备,没有任何问题。 会是什么呢?在Android或iOS上有一些限制,不允许从Android连接到iOS,反之亦然? 谢谢。 编辑:经过一些严格的测试后,我在AOSP页面上提出了一个问题。可以在这里检查

6
如何将多个原始参数传递给AsyncTask?
有相关的问题,例如如何将2个参数传递给AsyncTask类?,但是我遇到了徒劳地尝试将多个基元作为参数传递给AsyncTask的困难,所以我想分享自己发现的内容。现有的问题和答案中没有体现出这种微妙之处,因此,我想帮助那些遇到与我相同的问题的人,并减轻他们的痛苦。 问题是这样的:我有多个原始参数(例如两个long),我想传递给要在后台执行的AsyncTask-如何完成?(我的回答...经过一段时间的努力...可以在下面找到。)


9
(不建议使用)片段onOptionsItemSelected没有被调用
编辑: 这个问题是针对过时的夏洛克动作栏。现在应改为使用Android支持库 我添加了一个名为“分享给我”的操作栏菜单选项,fragment该选项出现了,但未捕获选择事件 我正在这样添加 @Override public void onCreateOptionsMenu (Menu menu, MenuInflater inflater) { MenuItem item = menu.add(0, 7,0, R.string.share); item.setIcon(R.drawable.social_share).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); } 尝试同时以fragment或fragment activity类似方式捕获它 @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case 7: Intent share = new Intent(Intent.ACTION_SEND); share.setType("text/plain"); share.putExtra(Intent.EXTRA_TEXT, "I'm being sent!!"); startActivity(Intent.createChooser(share, "Share Text")); return true; default: …

11
找不到android SDK(Unity)
错误: Invalid command android UnityEditor.HostView:OnGUI() CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct. See the Console for more details. C:/Program Files/Java/jdk1.8.0_121\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/Users/great/AppData/Local/Android/Sdk\tools" -Dfile.encoding=UTF8 -jar "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" - stderr[ Error:Invalid command android ] stdout[ ] exit code: 64 UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, …
82 android  unity3d 

2
NavigationView和自定义布局
我正在使用这样的设计支持库NavigationView: <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/drawer_layout" android:layout_height="match_parent" android:layout_width="match_parent" android:fitsSystemWindows="true"> <!-- put your main layout here --> <include layout="@layout/drawer_main_layout"/> <android.support.design.widget.NavigationView android:id="@+id/nav_view" android:layout_height="match_parent" android:layout_width="wrap_content" android:layout_gravity="start" android:fitsSystemWindows="true" app:headerLayout="@layout/nav_header" app:menu="@menu/drawer_view"/> </android.support.v4.widget.DrawerLayout> 我已经设置了这个菜单: <menu xmlns:android="http://schemas.android.com/apk/res/android"> <group android:checkableBehavior="single"> <item android:id="@+id/nav_home" android:icon="@drawable/ic_dashboard" android:title="Home" /> <item android:id="@+id/nav_messages" android:icon="@drawable/ic_event" android:title="Messages" /> <item android:id="@+id/nav_friends" android:icon="@drawable/ic_headset" android:title="Friends" /> <item android:id="@+id/nav_discussion" android:icon="@drawable/ic_forum" android:title="Discussion" …

5
Android:如何在代码中获取属性的值?
我想在代码中检索textApperanceLarge的int值。我相信下面的代码朝着正确的方向发展,但是无法弄清楚如何从TypedValue中提取int值。 TypedValue typedValue = new TypedValue(); ((Activity)context).getTheme().resolveAttribute(android.R.attr.textAppearanceLarge, typedValue, true);
82 android 

4
在操作栏中实施SearchView
我需要SearchView从我的创建,arrayList<String>并在下拉列表中显示与此相同的建议 我正在寻找可逐步解释如何SearchView在操作栏中构建的教程。 我已经阅读了文档并按照示例google进行了搜索,但对我没有用。 我已经创建了搜索 <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/action_search" android:title="Search" android:icon="@android:drawable/ic_menu_search" android:showAsAction="always" android:actionViewClass="android.widget.SearchView" /> </menu>` 但是我不知道如何设置字符串数组的参数。我尝试在其他“活动”中检索结果,但不起作用。

12
如何更改Android项目上的目标构建?
我目前在Eclipse中有一个Android项目。 我以1.5(sdk 3)的目标内部版本创建了它。 现在,我想对其进行更改,使其minSdk为3,targetSdk为8。 为此,我看到我必须针对最新的SDK(2.2)进行构建 要在Eclipse中执行此操作,请右键单击我的项目,转到属性,单击Android,然后将项目构建目标更改为Android 2.2,然后单击“应用”,然后单击“确定”。 但是,这似乎没有任何影响,当我再次尝试时,目标版本会重新设置为Android 1.5。 我错过了一步吗?
82 android  build  target 

6
通过意图传递ArrayList
我试图使用意图将arrayList传递给另一个活动。这是第一个活动中的代码。 case R.id.editButton: Toast.makeText(this, "edit was clicked", Toast.LENGTH_LONG).show(); Intent intent = new Intent(this, editList.class); intent.putStringArrayListExtra("stock_list", stock_list); startActivity(intent); break; 这是我尝试在第二个活动中检索列表的地方。这有什么问题吗? Intent i = new Intent(); //This should be getIntent(); stock_list = new ArrayList<String>(); stock_list = i.getStringArrayListExtra("stock_list");

14
证书受PC信任,但不受Android信任
从今天早上开始,我的证书不再受Android信任,因此我的应用程序无法再连接: Catch exception while startHandshake: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found. return an invalid session with invalid cipher suite of SSL_NULL_WITH_NULL_NULL javax.net.ssl.SSLPeerUnverifiedException: No peer certificate at org.apache.harmony.xnet.provider.jsse.SSLSessionImpl.getPeerCertificates(SSLSessionImpl.java:137) at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:93) at org.apache.http.conn.ssl.SSLSocketFactory.createSocket(SSLSocketFactory.java:381) at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:165) at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164) at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119) at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:591) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:807) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:781) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:770) …

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.