小编RMH*_*RMH的帖子

在Android开发中使用Cursor有什么用?

我正在浏览互联网上关于数据库连接,检索的一些代码.我Cursor cur1= moveToFirst()在许多代码中看到,我想知道游标的用途是什么以及为什么我们使用moveToFirst()因为我是android的新手.

android cursor

71
推荐指数
4
解决办法
6万
查看次数

显示Toast消息

我正在开发一个基于测验的应用程序,当用户点击任何选项时,它应该是一个合适的消息,例如"你的ans是正确的","你的ans是错的".我想要的是

 1. how to display that sort of messages ?or is it the only way to display such msgs ?
 2. If the user clicks wrong option the it should show the correct answer as well as the msg

here is what i have done so far but its not working giving force close!!!


public void onClick(View v) 
    {
        // TODO Auto-generated method stub
        switch (v.getId()) 
        {
        case R.id.button1:
            Log.d("ERR", v.getTag().toString());
            if (v.getTag().toString().equalsIgnoreCase("right")) 
            {
                displayAnswer();

            }
            else
            {
                errorAnswer();

            } …
Run Code Online (Sandbox Code Playgroud)

java android toast

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

检查无线电组是否为空/ null

我想在android中检查radiogroup是空的还是null,即提交而不点击该组中的任何单选按钮?

Xml代码

<RadioGroup
            android:id="@+id/lift"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="horizontal" >

            <RadioButton  
                android:paddingRight="50dip"  
                android:textSize="20dp"  
                android:id="@+id/r91"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/yes" />

            <RadioButton   
                android:paddingRight="50dip"   
                android:textSize="20dp"  
                android:id="@+id/r92"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/no" />
        </RadioGroup>
Run Code Online (Sandbox Code Playgroud)

活动代码

RadioGroup radioGroup1 = (RadioGroup) findViewById(R.id.lift);
if(radioGroup1=='NULL')
{ 
    Toast.makeText(getApplOicationContext(),"first radiogroup is null",Toast.LENGTH_LONG).show();
}
Run Code Online (Sandbox Code Playgroud)

java android

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

删除页面顶部的边框

所以基本上我无法删除页面的顶部.它只是白色空间,无论我改变了多少css,我似乎无法改变任何东西.我希望我的导航栏位于页面顶部,没有填充或边框或任何东西.这是我的代码,我知道这可能是最简单的事情,只是我现在找不到它.

HTML

<!DOCTYPE html>

<html>

<head>
    <meta name="Description" content="This is a test website!"/>
    <meta name="author" content="Me!"/>
    <title>test | Home</title>
    <link type="text/css" rel="stylesheet" href="css/style.css"/>
</head>

<body>

    <div id="wrapper">
        <nav id="navmenu">
            <ul>
                <li>Home</a>
                <li>About</li>
                <li>Tutorials</li>
                <li>Services</li>
                <li>Contact Us</li>
            </ul>

        <aside id="sidenews">

        </aside>

        <div id="center">

            <section id="mainsection">
                <article>
                    <header>
                        <hgroup>
                            <h1>This is a test</h1>
                            <h2>I like tests!</h2>
                        </hgroup>
                    </header>
                    <section>
                        <p>This is the main section of my section (sectception)</p>
                    </section>
                    <footer>
                        <p>Time and date</p>
                    </footer>
                </article>
            </section>

        </div>

        <footer id="cright">
            <p>This is the …
Run Code Online (Sandbox Code Playgroud)

html css

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

标签 统计

android ×3

java ×2

css ×1

cursor ×1

html ×1

toast ×1