我正在尝试制作一个圆形按钮,但我不知道该怎么做.我可以制作带圆角的按钮,但我怎么能圆圈.这是不一样的.请告诉我,Android上有可能吗?谢谢.
如何使用地址打开Google地图(使用Intents或将Google地图添加到我的应用程序中)?我有地址,但我没有纬度/经度.我该怎么做?谢谢.
有一个问题 - 我的主要活动启动服务然后关闭.当应用程序下次启动时,应用程序应该引用此服务并将其停止.但我不知道如何获得对正在运行的服务的引用.拜托,我希望你能帮助我.谢谢.
我一直在开发需要将图像设置为壁纸的应用程序.
码:
WallpaperManager m=WallpaperManager.getInstance(this);
String s=Environment.getExternalStorageDirectory().getAbsolutePath()+"/1.jpg";
File f=new File(s);
Log.e("exist", String.valueOf(f.exists()));
try {
InputStream is=new BufferedInputStream(new FileInputStream(s));
m.setBitmap(BitmapFactory.decodeFile(s));
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Log.e("File", e.getMessage());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Log.e("IO", e.getMessage());
}
Run Code Online (Sandbox Code Playgroud)
我还添加了以下权限:
<uses-permission android:name="android.permission.SET_WALLPAPER" />
Run Code Online (Sandbox Code Playgroud)
但它不起作用; 该文件存在于SD卡上.我哪里弄错了?
我有以下代码:
mQuestions=DictionaryDbWrapper.getInstance().getQuestionsSequence(
this.getIntent().getStringExtra(ApplicationUtilities.TEST_CATEGORY_PARAMETER), 50);
mQuestionsCount=mQuestions.size();
Log.e("count", String.valueOf(mQuestionsCount));
if (mQuestionsCount==0) {
Log.e("1", "111");
Toast.makeText(this, "? ?????? ????????? ??? ????", Toast.LENGTH_LONG).show();
this.finish();
}
makeQuestion();
Run Code Online (Sandbox Code Playgroud)
mQuestions是空的ArrayList,我看到count总是等于0.我也1/111总是在我的日志上看到记录.但是我的活动没有做完成方法!
makeQuestion是不需要使用空的方法mQuestion(它抛出异常).但如果我发表评论,makeQuestion那么finish方法效果很好!此代码的方法适用于主线程(从onCreate()方法执行).
请,建议我哪里出错了.
提前致谢.
我已经尝试过制作我的第一个Hibernate项目.我将以下库添加到我的项目中:
antlr-2.7.7 commons-collections-3.2.1 dom4j-1.6.1 hibernate-commons-annotations-4.0.1.Final hibernate-core-4.1.0.Final hibernate-jpa-2.0-api-1.0.1.Final javassist-3.15.0-GA jboss-logging-3.1.0.CR2 jboss-transaction-api_1.1_spec-1.0.0.Final mysql-connector-java-5.1.18-bin
hibernate.cfg.xml中:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.url">jdbc:mysql://localhost/test</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password"></property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</property>
<mapping class="com.nda.hibernate.Person"/>
</session-factory>
</hibernate-configuration>
Run Code Online (Sandbox Code Playgroud)
Person.class:
package com.nda.hibernate;
import javax.persistence.Entity;
import javax.persistence.Id;
@Entity
public class Person {
private String name;
@Id
private int number;
public Person() {}
public Person(String name, int number) {
this.name=name;
this.number=number;
}
public void setName(String name) {
this.name=name;
}
public String getName() { …Run Code Online (Sandbox Code Playgroud) 我有以下课程:
class UnionFuzzySet : public FuzzySet
{
public:
UnionFuzzySet();
void addActivatedFuzzySet(const ActivatedFuzzySet &set);
double getValue(double value);
private:
QSet<ActivatedFuzzySet> subConclusions;
};
Run Code Online (Sandbox Code Playgroud)
方法addActivatedFuzzySet(...):
void UnionFuzzySet::addActivatedFuzzySet(const ActivatedFuzzySet &set)
{
this->subConclusions << set;
}
Run Code Online (Sandbox Code Playgroud)
它不适用于编译错误:
c:\ QtSDK\Desktop\Qt\4.8.0\msvc2010\include\QtCore\qhash.h:882:ошибка:C2665:'qHash':16个重载中没有一个可以转换所有参数类型c:\ QtSDK\Desktop\Qt\4.8.0\msvc2010\include\QtCore/qhash.h(62):可能是'uint qHash(char)'c:\ QtSDK\Desktop\Qt\4.8.0\msvc2010\include\QtCore/qhash. h(63):或'uint qHash(uchar)'c:\ QtSDK\Desktop\Qt\4.8.0\msvc2010\include\QtCore/qhash.h(64):或'uint qHash(signed char)'c:\QtSDK\Desktop\Qt\4.8.0\msvc2010\include\QtCore/qhash.h(65):或'uint qHash(ushort)'c:\ QtSDK\Desktop\Qt\4.8.0\msvc2010\include\QtCore /qhash.h(66):或'uint qHash(短)'c:\ QtSDK\Desktop\Qt\4.8.0\msvc2010\include\QtCore/qhash.h(67):或'uint qHash(uint)' c:\ QtSDK\Desktop\Qt\4.8.0\msvc2010\include\QtCore/qhash.h(68):或'uint qHash(int)'c:\ QtSDK\Desktop\Qt\4.8.0\msvc2010\include\QtCore/qhash.h(69):或'uint qHash(ulong)'c:\ QtSDK\Desktop\Qt\4.8.0\msvc2010\include\QtCore/qhash.h(77):或'uint qHash(long) )'c:\ QtSDK\Desktop\Qt\4.8.0\msvc2010\include\QtCore/qhash.h(78):或'uint qHash(quint64)'c:\ QtSDK\Desktop\Qt\4.8.0\msvc2010\include\QtCore/qhash.h(86):或'uint qHash(qint64)'c:\ QtSDK\Desktop\Qt\4.8.0\msvc2010\include\QtCore/qhash.h(87):或'uint qHash(QChar)'c:\ QtSDK\Desktop\Qt\4.8.0\msvc2010\include\QtCore/qhash.h(88) ):或'uint qHash(const QByteArray&)'c:\ QtSDK\Desktop\Qt\4.8.0\msvc2010\include\QtCore/qhash.h(89):或'uint qHash(const QString&)'c:\QtSDK\Desktop\Qt\4.8.0\msvc2010\include\QtCore/qhash.h(90):或'uint qHash(const QStringRef&)'c:\ QtSDK\Desktop\Qt\4.8.0\msvc2010\include\QtCore/qhash.h(91):或'uint qHash(const QBitArray&)'试图匹配参数列表'(const ActivatedFuzzySet)'
请告诉我,我在哪里弄错了?
我有一个主JFrame和一个额外的JFrame用于输入许多其他参数.所以,我需要我的第二个jframe将数据返回到主jframe(使用ActionListener进行"保存"按钮),但我不知道如何做到这一点.请告诉我,我希望你能帮助我.谢谢.
我是Swing的新用户,我有按坐标绘制组件的问题.请看这段代码:
JFrame frame=new JFrame();
frame.setBounds(new Rectangle(0, 0, 700, 600));
frame.getContentPane().setBackground(Color.yellow);
frame.setVisible(true);
JPanel graph=new JPanel();
graph.setBounds(new Rectangle(0, 0, 700, 300));
graph.setBackground(Color.white);
graph.setOpaque(true);
frame.getContentPane().add(graph);
Run Code Online (Sandbox Code Playgroud)
我需要JPanel从JFrame关闭50%,但现在它关闭100%,JFrame背景为白色.我该如何解决这个错误?另外,使用百分比设置宽度和高度是否有任何意义?例如,宽度为50%.或者可能存在我的问题的任何容器?谢谢
我有以下简单的代码:
for (float i=0; i<1f; i+=0.1) {
System.out.println(i);
}
Run Code Online (Sandbox Code Playgroud)
我刚刚得到以下结果:
0.0
0.1
0.2
0.3
0.4
0.5
0.6
0.70000005
0.8000001
0.9000001
Run Code Online (Sandbox Code Playgroud)
但我无法理解为什么会这样.拜托,我希望你能告诉我.谢谢.
我的大学也有类似的有趣任务.例如,有ClassA.我需要限制对象的访问权限,如果今天是星期天客户端无法生成ClassA对象或使用现有的ClassA对象.我想我需要为类创建一些包装器,否则我需要在ClassA的每个方法中检查一天的条件.是否有任何设计模式?拜托,我希望你能帮助我.