在使用ccWave时,其中一个参数是grid,它显示该值应该是类型ccGridSize.
我想知道什么ccGridSize是...变量应该给出什么值ccGridSize?
ccWaves的代码如下......
[CCWaves actionWithWaves:<(int)> amplitude:<(float)>
horizontal:<(BOOL)> vertical:<(BOOL)>
grid:<(ccGridSize)> duration:<(ccTime)>];
Run Code Online (Sandbox Code Playgroud)
可以在参数网格的位置给出什么值?
当我尝试访问shared preference扩展的类中的from 时,我收到错误View.
错误:" The method getSharedPreferences(String, int) is undefined for the type ViewforRed",
ViewforRed是我的班级
这是示例代码
public class ViewforRed extends View
{
public final String PREFS_NAME = "GRAPHICS";
SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
public ViewforRed(Context context)
{
super(context);
}
public void onDraw(Canvas canvas)
{
Paint paint = new Paint();
float p0,p1,p2,p3,p4,p5,p6,p7,p8,p9;
}
}
Run Code Online (Sandbox Code Playgroud) 当我在手机上启动应用程序时,我从日志中收到以下错误:
E/dalvikvm( 2052): No free temp registers
E/dalvikvm( 2052): Jit: aborting trace compilation, reverting to interpreter
E/dalvikvm( 2052): No free temp registers
E/dalvikvm( 2052): Jit: aborting trace compilation, reverting to interpreter
Run Code Online (Sandbox Code Playgroud)
发生了什么 ?
我试图运行简单的应用程序从Android模拟器访问互联网,这是我的代码.我支持代理并在模拟器中通过"...无线网络 - > APN - > ..."配置代理设置.但互联网是从浏览器而不是应用程序.
HttpURLConnection connection = null;
String URLName = "http://www.google.com";
try {
URL u = new URL(URLName);
connection = (HttpURLConnection) u.openConnection();
connection.setRequestMethod("HEAD");
int code = connection.getResponseCode();
Log.d(TAG1, " " + code);
// You can determine on HTTP return code received. 200 is success.
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Log.d(TAG1, e.toString());
}
finally {
if (connection != null) { …Run Code Online (Sandbox Code Playgroud) 我从Android开发者(http://developer.android.com/reference/android/app/Activity.html)中看到,有一个很好的流程图显示onCreate导致onStart当时onResume等等.我的问题是:什么其他的on****()方法出现在之间onCreate和onStart?
例如,我一直在研究这个主题,我知道其他方法,例如onMeasure和onSizeChanged,onDraw等等.它们在哪里适合该流程图?
谢谢.
我需要总是在屏幕上显示选项菜单..我已经在活动启动时编写了打开选项菜单的代码.
@Override
public void onAttachedToWindow() {
openOptionsMenu();
};
Run Code Online (Sandbox Code Playgroud)
但是当点击屏幕上的另一个项目时,菜单会关闭..我希望菜单始终显示在屏幕上..有没有办法做到这一点?
我的文件assets夹中有一个.db文件.我已将其复制到data/data/<packagename>/databases/模拟器中的文件夹中,并且工作正常.
但是当我在设备上运行时,它会强行关闭.它正在显示
SQLite exception: no such table: tbl_user
Run Code Online (Sandbox Code Playgroud)
这是我的代码..
public class DatabaseHelper extends SQLiteOpenHelper {
public DatabaseHelper() {
super(dataContext, DATABASE_NAME, null, 1);
DB_PATH = "/data/data/"
+ dataContext.getApplicationContext().getPackageName()
+ "/databases/";
Log.d("PATH", DB_PATH);
boolean dbExist = checkDataBase();
if (!dbExist) {
this.getReadableDatabase();
try {
copyDataBase();
} catch (IOException e) {
Log.d("Error", e.toString());
}
}
}
private void copyDataBase() throws IOException {
// TODO Auto-generated method stub
InputStream inFile = dataContext.getAssets().open(DATABASE_NAME);
String outFileName = DB_PATH + DATABASE_NAME;
OutputStream myOutput = …Run Code Online (Sandbox Code Playgroud) 我需要将活动A中的EditText数据发送到活动B.我试过:
Intent intent1=new Intent(A.this,B.class);
intent1.putExtra("fromA", "text");
startActivity(intent1);
Run Code Online (Sandbox Code Playgroud)
但它不起作用,因为活动B android:launchMode="singleTask"之前已经创建过.
怎么回事,我可以发送数据吗?
我需要在长按列表项时显示删除按钮.
我有长按的代码..但不知道如何编码在这个长按内显示一个按钮...
我正在尝试以编程方式将a设置StateListDrawable为库项目的自定义视图的背景.这是我正在做的事情:
final TypedArray a = getContext().obtainStyledAttributes(attrs,
R.styleable.ActionBar);
int firstColor = a.getColor(
R.styleable.ActionBar_backgroundGradientFirstColor, 0xff000000);
int secondColor = a
.getColor(R.styleable.ActionBar_backgroundGradientSecondColor,
0xff000000);
int textViewColor = a.getColor(R.styleable.ActionBar_titleColor,
0xffffffff);
int onClickColor = a.getColor(
R.styleable.ActionBar_backgroundClickedColor, 0xff999999);
a.recycle();
StateListDrawable sld = new StateListDrawable();
GradientDrawable drawable = new GradientDrawable(
Orientation.TOP_BOTTOM, new int[] { firstColor, secondColor });
sld.addState(new int[] { android.R.attr.state_enabled },
new ColorDrawable(onClickColor));
sld.addState(new int[] { android.R.attr.state_pressed }, drawable);
action2.setBackgroundDrawable(sld);
action3.setBackgroundDrawable(sld);
actionBack.setBackgroundDrawable(sld);
pb.setBackgroundDrawable(drawable);
tv.setBackgroundDrawable(drawable);
tv.setTextColor(textViewColor);
Run Code Online (Sandbox Code Playgroud)
但是,这不起作用:它总是绘制启用状态.我希望它来绘制按下时,我的状态按下按钮.我究竟做错了什么?
android ×9
assets ×1
button ×1
dalvik ×1
eclipse ×1
exception ×1
java ×1
listview ×1
long-press ×1
networking ×1
oncreate ×1
onstart ×1
options-menu ×1
proxy ×1
sqlite ×1