在尝试对我的数据库执行查询时,我得到此异常.但是,文档声明该方法SQLiteDatabase.query(...)返回"一个Cursor对象,它位于第一个条目之前",我将其解释为意味着Cursor位于返回的行的开头.如果我Cursor.moveToFirst()在Cursor中访问数据之前添加,我没有异常.到底是怎么回事?在尝试获取数据之前,是否需要始终调用"moveToFirst"?文档说这个方法,"将光标移动到第一行."
Cursor c = db.query(TABLENAME, null, null, null, null, null, null);
Log.d("TAG",""+c.getInt(c.getColumnIndex("_id")));
Run Code Online (Sandbox Code Playgroud) 我刚刚将应用程序的(2.2)版本更改为1.5.之后,我在这样的XML文件中出错了
error: No resource identifier found for attribute 'onClick' in package 'android'
为什么我不能使用那种方法.否则,是否有任何额外的jar可用于在Android 1.5版中使用此方法.有人告诉我.
我只是使用TouchEvent方法创建一个用于在屏幕上写文本的应用程序.它工作正常.看到这是代码
public TouchEventView(Context context, AttributeSet attrs) {
super(context, attrs);
paint.setAntiAlias(true);
paint.setColor(Color.WHITE);
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeJoin(Paint.Join.ROUND);
paint.setStrokeWidth(5f);
}
@Override
protected void onDraw(Canvas canvas) {
canvas.drawPath(path, paint);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
float x = event.getX();
float y = event.getY();
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
path.moveTo(x, y);
return true;
case MotionEvent.ACTION_MOVE:
path.lineTo(x, y);
break;
default:
return false;
}
invalidate();
return true;
Run Code Online (Sandbox Code Playgroud)
之后,我编写了清除布局内容的代码: -
LinearLayout li = (LinearLayout)findViewById(R.id.linear);
li.clearAnimation();
Run Code Online (Sandbox Code Playgroud)
我的Logcat
11-18 16:10:18.681: I/System.out(22859): This is a log message
11-18 16:10:18.681: E/Mein Tag(22859): Hello …Run Code Online (Sandbox Code Playgroud) 这是我的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="75dp"
android:padding="3dp" >
<ImageView
android:id="@+id/img"
android:layout_width="75dp"
android:layout_height="75dp"
android:scaleType="fitCenter"
/>
<TextView
android:id="@+id/name"
android:layout_width="208dp"
android:layout_height="75dp"
android:paddingLeft="15dp"
android:paddingTop="15dp" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_gravity="center"
android:src="@drawable/ash_arrow" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
我怎样才能展现ImageView圆角?
我在应用程序中创建一个警报,每天早上8点运行并处理一些业务逻辑.有人可以确认在卸载应用程序时是否会自动杀死/删除警报?或者我是否需要专门处理PACKAGE_REMOVED删除警报的意图?
非常感谢提前.维奈
我只需要下载图像,但问题是图像损坏了!我找到了许多下载图像的方法,但仍然出现了这个问题.
我尝试这样做:
File path = Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_PICTURES);
File file2 = new File(path,"DemoPictureX.png");
InputStream is=(InputStream) new URL("http://androidsaveitem.appspot.com/downloadjpg").getContent();
OutputStream os = new FileOutputStream(file2);
byte[] data = new byte[is.available()];
is.read(data);
os.write(data);
is.close();
os.close();
Run Code Online (Sandbox Code Playgroud)
我认为它只是阅读图像中的一些行!
通过使用setRequestedOrientationin ,我可以以编程方式完美地管理方向变化onCreate.
一切正常,直到我插上HDMI线.在此之后,平板电脑"希望"处于横向模式.所以,当我打开一个活动,它显示在首"风景",然后将其显示之后在"肖像",(因为我打电话的setRequestedOrientation(variable_with_orientation_desired_by_the_user)地方variable=ActivityInfo.SCREEN_ORIENTATION_PORTRAIT在onCreate你可以"看",我的应用程序保持在每一个活动旋转用户打开;
如果我在清单中设置活动的方向,则此问题已部分消失,因为清单中的方向与用户拾取的方向相同.如果它们不同,则会再次开始相同的行为.
我试过这个,但没有成功:
@Override
public void onCreate(final Bundle saved)
{
setRequestedOrientation(ScreenOrientation);
super.onCreate(icicle);
}
Run Code Online (Sandbox Code Playgroud)
那么,有什么方法可以告诉android它在创建活动之前必须创建什么样的方向?(但它不能显而易见)
android orientation screen-orientation android-orientation android-activity
我想创建一个弹出窗口,如下面给出的链接.我以为它会使用QuickContactBabage,但事实并非如此.并且不打算如何创建它.
图片链接http://cdn3.staztic.com/screenshots/android-swim-32-2.jpg
提前致谢
我想制作一个检测wifi网络的简单应用程序,在选择网络后,它会启动(连接)到所选网络.
我已经为检测阶段编写了代码但是如何在onItemClick()中连接到所选网络.请建议代码.
我只是尝试使用自定义启动器图标而不是锁定屏幕下方的相机来自定义锁定屏幕 -

我在谷歌搜索这个.我得到了一个响应,我们可以自定义它.但是,Apple不会批准这一点.
但是,我的要求就是我们可以直接从上面的图片中放置我们的应用程序图标而不是相机,直接启动我们的应用程序 Lock Screen
任何想法/帮助非常感谢?
android ×9
alarmmanager ×1
android-wifi ×1
clear ×1
cursor ×1
database ×1
exception ×1
indexing ×1
iphone ×1
list ×1
lockscreen ×1
objective-c ×1
onclick ×1
onitemclick ×1
orientation ×1
popup ×1
touch ×1
xml ×1