为什么我在包含的行上会出现弃用错误setWallpaper(bmp),如何解决?
错误:不推荐使用Context类型的方法setWallpaper(Bitmap)
switch(v.getId()){
case R.id.bSetWallpaper:
try {
getApplicationContext().setWallpaper(bmp);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
break;
Run Code Online (Sandbox Code Playgroud) 嘿所以我目前正在为大学编写一个程序,在创建我的课程时,我正在使用get set我的问题是,是否有一种比设置方法所示的方法更简单的方法.
显示我当前方式的代码段
private string customer_first_name;
private string customer_surname;
private string customer_address;
public DateTime arrival_time;
//Using accessors to get the private variables
//Using accessors to set the private variables
public string Customer_First_Name
{
get { return customer_first_name; }
set { customer_first_name = value; }
}
Run Code Online (Sandbox Code Playgroud) 嘿,所以我有下面的代码,如果文本框为空,它应该抛出错误,但它不只是继续它会做的事情,如果它们不是,而是将一个带有 0 或任何内容的项目添加到列表中,是我的代码有问题吗?
private void BtnAdd_Click(object sender, EventArgs e)
{
try
{
theVisit.name = txtName.Text;
theVisit.address = txtAddress.Text;
theVisit.arrival = DateTime.Parse(txtArrival.Text);
//Update theVisit object to reflect any changes made by the user
this.Hide();
//Hide the form
}
catch (Exception)
{
if (txtName.Text == "")
MessageBox.Show("please enter a customer name");
if(txtAddress.Text == "")
MessageBox.Show("Please enter a customer address");
if(txtArrival.Text == "")
MessageBox.Show("Please enter an arrival time");
}
Run Code Online (Sandbox Code Playgroud)
新的
if (txtName.Text == "" || txtAddress.Text == "" || txtArrival.Text == "")
MessageBox.Show(" …Run Code Online (Sandbox Code Playgroud) 我有一个DateTime选择器将到达时间添加到列表中,我有两个问题:
12-Jan-2012而不是12/01/12?我目前的代码不是很先进:
theVisit.ArrivalTime = DateTimePicker1.Value
Run Code Online (Sandbox Code Playgroud) 嘿所以我本周刚开始学习基本的c ++,我有一个问题说:
编写一个程序来比较3个整数并打印最大的,程序应该只使用2个IF语句.
我不知道如何做到这一点所以任何帮助将不胜感激
到目前为止我有这个:
#include <iostream>
using namespace std;
void main()
{
int a, b, c;
cout << "Please enter three integers: ";
cin >> a >> b >> c;
if ( a > b && a > c)
cout << a;
else if ( b > c && b > a)
cout << b;
else if (c > a && c > b)
cout << b;
system("PAUSE");
}
Run Code Online (Sandbox Code Playgroud) 所以我试图运行这个应用程序,我用来了解线程和意图,但应用程序将无法运行,但我没有任何警告/错误下划线代码,任何人都可以帮助我.
清单代码:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.learn.tam.Splash"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.SPLASH" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.example.learn.tam.StartingPoint"
android:label="@string/app_name" >
</activity>
</application>
</manifest>
Run Code Online (Sandbox Code Playgroud)
和活动代码
package com.example.learn.tam;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
public class Splash extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
Thread timer = new Thread(){
public void run(){
try {
sleep(5000);
}
catch (InterruptedException e){
e.printStackTrace();
}
finally{
Intent openStartingPoint = …Run Code Online (Sandbox Code Playgroud) c# ×3
android ×2
java ×2
.net ×1
c++ ×1
datetime ×1
properties ×1
try-catch ×1
validation ×1
wpftoolkit ×1