小编san*_*tar的帖子

在Android中滑动

嗨,大家好我正在做一个Android项目来实现滑动功能.怎么做.

我尝试使用onfling方法,但它对我不起作用..任何人都有正确的解决方案请回复此帖.

我的onfling代码是

@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
    if (mGesturesEnabled) {
        try {
            if (e2.getY() - e1.getY() > StudyOptions.sSwipeMinDistance && Math.abs(velocityY) > StudyOptions.sSwipeThresholdVelocity && Math.abs(e1.getX() - e2.getX()) < StudyOptions.sSwipeMaxOffPath && !mIsYScrolling) {
                // down
                executeCommand(mGestureSwipeDown);
            } else if (e1.getY() - e2.getY() > StudyOptions.sSwipeMinDistance && Math.abs(velocityY) > StudyOptions.sSwipeThresholdVelocity && Math.abs(e1.getX() - e2.getX()) < StudyOptions.sSwipeMaxOffPath && !mIsYScrolling) {
                // up
                executeCommand(mGestureSwipeUp);
            } else if (e2.getX() - e1.getX() > StudyOptions.sSwipeMinDistance && Math.abs(velocityX) > StudyOptions.sSwipeThresholdVelocity && Math.abs(e1.getY() …
Run Code Online (Sandbox Code Playgroud)

android swipe

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

如何从给定值获得平均值

我如何平均?我想要找到GPA学生总数和学生总数的平均值GPA.例:

输入:4 4 4 4

输出: 学生总数:4

总GPA:16

平均GPA: 4

import java.util.Scanner;

public class practice {
    public static void main(String[] args) {
        Scanner keyboard = new Scanner(System.in);
        int count = 0;
        double GPA = 0, total = 0, average;

        System.out.println("Enter GPA");

        while (GPA >= 0) {
            GPA = keyboard.nextDouble();
            total = total + GPA;
            count++;
        }

        average = total / count;

        System.out.println("Total students: " + count);
        System.out.println("Total GPA " + total);
        System.out.println("Average GPA …
Run Code Online (Sandbox Code Playgroud)

java average

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

需要明确以下计划,

以下程序将打印什么?

#include <iostream> 
using namespace std;    

static int x = 10;

void main1()    
{      
    cout << x << endl;    
    x = x + 1;    
}    

int main()   
{    
    main1();    
    main1();        
    cout << x << endl;    
}
Run Code Online (Sandbox Code Playgroud)

根据我的理解,上面的程序我们使用了静态变量,因此x保留了最后一个初始化变量.所以输出将是

10    
11    
12
Run Code Online (Sandbox Code Playgroud)

但如果我们删除静态,我们应该得到

10    
10    
10
Run Code Online (Sandbox Code Playgroud)

但即使在去除静电后,我也得到了以下输出.

10    
11    
12
Run Code Online (Sandbox Code Playgroud)

请帮我理解.

c++

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

内容提供商

我遇到了内容提供商的问题.我正在尝试创建一个内容提供商.

    public static final Uri CONTENT_URI = 
               Uri.parse("content://data/data/one.two/databases");
Run Code Online (Sandbox Code Playgroud)

这导致我的数据库,因为我想从中提取数据并在列表视图中显示它.之后,我必须编辑插入提供程序的清单

<provider android:name="databases789"
    android:grantUriPermissions="true"
    android:enabled="true"
    android:syncable="true" 
    android:authorities="one.two.databases" >
</provider> 
Run Code Online (Sandbox Code Playgroud)
  1. 我的URI被正确解析了吗?
  2. 如果我将我的课程扩展到Content Provider,我的数据库文件会有点搞砸,有更简单的方法吗?

但是,它显示了没有one.two.databases存在的错误.

android listview android-contentprovider

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

标签 统计

android ×2

android-contentprovider ×1

average ×1

c++ ×1

java ×1

listview ×1

swipe ×1