我想使用自动完成textview选择联系人发送短信.我几乎实现了我想要的,但是你可以在图像中看到一分钟的问题.我怎么解决这个问题?
activity_contact_with_auto.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<AutoCompleteTextView
android:id="@+id/mmWhoNo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="To...." >
</AutoCompleteTextView>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
custcontview.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/ccontName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#A5000000" />
<TextView
android:id="@+id/ccontNo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/ccontName"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#A5000000" />
<TextView
android:id="@+id/ccontType"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@id/ccontNo"
android:layout_alignParentRight="true"
android:layout_marginRight="14dp"
android:text="Small Text"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#A5000000" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
码
public class ContactWithAuto extends Activity {
private ArrayList<Map<String, String>> mPeopleList;
private SimpleAdapter mAdapter;
private AutoCompleteTextView mTxtPhoneNo;
@Override …Run Code Online (Sandbox Code Playgroud) 我正在尝试为我的应用程序制作多个联系人选择器.我正在使用带复选框的自定义布局来选择多个联系人.我面临的问题是,为了选择任何特定的联系人,我需要在复选框上完全点击,如果我点击该行的其他部分,则复选框不会被勾选.如何确保用户在整行中单击的位置勾选复选框.
activity_contacts_picker.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<Button
android:id="@+id/btnShow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Show Selected" />
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_below="@+id/btnShow" >
</ListView>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
custcontactview.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingBottom="5.0px"
android:paddingLeft="5.0px"
android:paddingTop="5.0px" >
<TextView
android:id="@+id/txtContactName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15.0dip"
android:layout_toLeftOf="@+id/checkBox1"
android:layout_alignParentLeft="true"
android:text="Medium Text"
android:textAppearance="?android:textAppearanceMedium" />
<TextView
android:id="@+id/txtContactNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/txtContactName"
android:layout_alignParentLeft="true"
android:layout_marginLeft="15.0dip"
android:layout_toLeftOf="@+id/checkBox1"
android:text="Small Text"
android:textAppearance="?android:textAppearanceSmall" />
<CheckBox
android:id="@+id/checkBox1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:clickable="true"
android:focusable="true"
android:focusableInTouchMode="false" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
ContactsPicker.java
public class ContactsPicker extends ListActivity {
protected Object mActionMode; …Run Code Online (Sandbox Code Playgroud) 我想LoaderManager在我的应用程序中实施以减少启动时间正如您在此处看到的,但在该线程中实施建议后,我收到以下错误initLoader(int, Bundle, LoaderManager.LoaderCallbacks) in the type LoaderManager is not applicable for the arguments (int, null, MainActivity)。在这里搜索后,我发现对于第二个错误的解决方案在这里。但是在实施了后来的建议之后,现在我收到了错误java.lang.NullPointerException
at android.support.v4.content.Loader。我正在提供我目前拥有的代码,谁能告诉我,我该如何解决这个问题
完整代码可以在 这里看到
原木猫
10-03 20:11:34.849: E/AndroidRuntime(2968): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.test.sms.it/com.test.sms.it.MainActivity}: java.lang.NullPointerException
10-03 20:11:34.849: E/AndroidRuntime(2968): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
10-03 20:11:34.849: E/AndroidRuntime(2968): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
10-03 20:11:34.849: E/AndroidRuntime(2968): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
10-03 20:11:34.849: E/AndroidRuntime(2968): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
10-03 20:11:34.849: E/AndroidRuntime(2968): at android.os.Handler.dispatchMessage(Handler.java:99)
10-03 20:11:34.849: E/AndroidRuntime(2968): at android.os.Looper.loop(Looper.java:123)
10-03 20:11:34.849: E/AndroidRuntime(2968): at android.app.ActivityThread.main(ActivityThread.java:3683)
10-03 20:11:34.849: E/AndroidRuntime(2968): …Run Code Online (Sandbox Code Playgroud) 我想在我的Android模拟器中访问互联网,我已手动输入dns设置,如下面的链接中所述 如何设置Android模拟器的Internet选项?
但仍然当我启动模拟器它显示警告没有发现DNS服务器,因此我的Android模拟器中没有互联网连接.我怎么解决这个问题.
我正在为android创建一个应用程序,我正在使用微调器检索sms网关的名称.我已经使用api发送短信,但我的主api不支持其他api支持的网站,所以我实现了如果用户选择不支持主api的网站的其他验证使用第二个api.我附上了问题的截图.看看红色框中的代码和日志猫.您可以在图像中看到的问题是,即使IF CONDITION为TRUE,它也会遇到ELSE部分.是什么导致了这样的问题?

android ×5
api ×1
autocomplete ×1
checkbox ×1
contact ×1
dns ×1
if-statement ×1
listview ×1
row ×1