我有一张名为employee的表,里面有他的id,姓名,电话号码.我使用MySQL作为我的数据库.我正在使用Java Swing.我正在使用Java搜索员工表名称(我like在Java页面中使用过子句).
现在我需要在存储过程中实现该功能.可能吗?如果有可能的话,我们怎样才能在Java代码中使用结果集?
现在我编写了如下存储过程
BEGIN
SELECT * FROM employee where empName like '%su%'
END
Run Code Online (Sandbox Code Playgroud)
示例代码将不胜感激..谢谢
我是android世界的新手.
我已经申请了用户注册.它工作正常.但当我试图将微调器添加到我的活动文件时,它在avd中显示错误,如,
应用程序注册(Process com.students)意外停止.请再试一次
谈到.
我的日志猫显示错误
"11-12 10:42:06.816:E/dalvikvm(313):无法打开堆栈跟踪文件'/data/anr/traces.txt':权限被拒绝"
究竟是什么错误?我怎么能摆脱那个?
我必须开发一个android视图,这样我就有2个微调控件,一个用于州,第二个用于城市.
我的问题是,无论何时选择州,我如何自动填充城市微调器?
它背后的逻辑是什么?
我的string.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="spinner_category"></string>
<string-array name="category_state">
<item >kerala</item>
<item >tamil nadu</item>
<item >Andra Pradesh</item>
<item >karnataka</item>
</string-array>
</resources>
Run Code Online (Sandbox Code Playgroud)
我的main.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">
<LinearLayout android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dip"
android:text="Select : "/>
<Spinner android:layout_width="250dip"
android:layout_height="wrap_content"
android:id="@+id/spinner_state"/>
</LinearLayout>
<LinearLayout android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dip"
android:text="Select : "/>
<Spinner android:layout_width="250dip"
android:layout_height="wrap_content"
android:id="@+id/spinner_state"/>
</LinearLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
还有我的activity.java文件:
package com.converter;
import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
public class ConverterActivity …Run Code Online (Sandbox Code Playgroud) 我为我的应用程序设计了一个自定义标题栏.它也适合我.但有一个问题.在我的自定义标题栏覆盖之前,可以看到默认标题(仅一秒钟).有没有解决方案来禁用android提供的默认标题栏?
我的代码就像......
res/layout中的window_title.xml
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/myTitle"
android:text="custom title bar"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textColor="@color/titletextcolor"
android:gravity ="center"/>
Run Code Online (Sandbox Code Playgroud)
res/values中的color.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="customTheme" parent="android:Theme">
<item name="android:windowTitleBackgroundStyle">@style/WindowTitleBackground </item>
</style>
</resources>
Run Code Online (Sandbox Code Playgroud)
res/values中的styles.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="titlebackgroundcolor">#303010</color>
<color name="titletextcolor">#FFFF00</color>
</resources>
Run Code Online (Sandbox Code Playgroud)
res/values中的themes.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="WindowTitleBackground">
<item name="android:background">@color/titlebackgroundcolor</item>
</style>
</resources>
Run Code Online (Sandbox Code Playgroud)
我还更新了我的manifest.xml的活动
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.title"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="7" />
<application
android:icon="@drawable/ic_launcher"
android:theme="@style/customTheme"
android:label="@string/app_name" >
<activity
android:name=".CustomTitleActivity"
android:theme="@style/customTheme" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" …Run Code Online (Sandbox Code Playgroud) 我正在尝试开发一个简单的地图应用程序,它将在屏幕上显示一个地图.
当用户在屏幕上移动光标时,我想在地图上显示2条垂直线.我曾尝试过许多例子来了解这一点,但不幸的是,没有成功.我该怎么做?
正如我之前提出的一个问题,我曾尝试过.但没有得到答案.谁能指导我?
我的main.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" >
<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView android:id="@+id/main_imagemap"
android:src="@drawable/worldmap"
android:clickable="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
和我的活动文件(我刚开始..)
import android.app.Activity;
import android.os.Bundle;
import android.widget.ImageView;
public class LineMapActivity extends Activity
{
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ImageView map_image = (ImageView)findViewById(R.id.main_imagemap);
}
}
Run Code Online (Sandbox Code Playgroud)
就像在那个链接中一样,我也添加了MyImageView.
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.widget.ImageView;
public class MyImageView extends ImageView
{
public MyImageView(Context context) {
super(context);
// TODO Auto-generated constructor stub
}
@Override
protected …Run Code Online (Sandbox Code Playgroud) 我刚接触到android.我试图构建一个有2个微调器的应用程序......在深入了解我的应用程序之前,我几乎没有疑惑.
请简要回答我的问题......
setOnItemSelectedListener(this)为两者添加吗?spinner.getSelectedItemPosition();两个纺纱厂一样?等待你的宝贵回复.参考资料也很明显
我有一个数组,一个双数组像......
Double my_array = new Double[] {6272640.0, 43560.0, 4840.0, 0.0015625, 4046856422.400000095, 40468564.223999999, 4046.856422400, 0.004046856, 1.0, 0.404685642};
Run Code Online (Sandbox Code Playgroud)
在我的程序中,我想将每个元素与一些整数值相乘......我通过变量n接受它.
我在我的程序中完成了它...
for(int 1=0;i<my_array.length;i++)
{
my_array[i] = n*my_array[i];
}
Run Code Online (Sandbox Code Playgroud)
当我尝试打印结果时,我获得了指数的价值......比如,3.23E等......
我需要将结果作为最多8个小数点的双精度值...
我应该怎么做才能得到它