我正在浏览互联网上关于数据库连接,检索的一些代码.我Cursor cur1= moveToFirst()在许多代码中看到,我想知道游标的用途是什么以及为什么我们使用moveToFirst()因为我是android的新手.
我正在开发一个基于测验的应用程序,当用户点击任何选项时,它应该是一个合适的消息,例如"你的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) 我想在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) 所以基本上我无法删除页面的顶部.它只是白色空间,无论我改变了多少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)