GreenDAO是否支持多列的主键?
我在两列上使用Property的方法primaryKey(),但它不起作用.我得到例外:
引起:android.database.sqlite.SQLiteException:表"table"有多个主键
如何在多列上创建主键?我应该编辑生成的DAO类吗?
我在我的项目中使用Volley库但是我遇到了OutOfMemory异常的问题.在我的应用程序中,我通过NetworkImageView使用setImageUrl方法从服务器下载拇指和全尺寸图像.我正在使用BitmapLruCache:
public class BitmapLruCache extends LruCache<String, Bitmap> implements ImageLoader.ImageCache {
public static int getDefaultLruCacheSize() {
final int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024);
final int cacheSize = maxMemory / 8;
return cacheSize;
}
public BitmapLruCache() {
this(getDefaultLruCacheSize());
}
public BitmapLruCache(int sizeInKiloBytes) {
super(sizeInKiloBytes);
}
@Override
protected int sizeOf(String key, Bitmap value) {
return value.getRowBytes() * value.getHeight() / 1024;
}
@Override
public Bitmap getBitmap(String url) {
return get(url);
}
@Override
public void putBitmap(String url, Bitmap bitmap) {
put(url, bitmap); …Run Code Online (Sandbox Code Playgroud) 我在Android Studio中导入了一个Phonegap项目,并将其作为基于Gradle的项目.
现在我正在尝试编译一些外部依赖项,我收到此错误:
错误:(72,13)无法解决:com.loopj.android:android-async-http:1.4.6
在"项目结构"对话框的" 文件显示"中显示
我试图通过进入File-> ProjectStructure-> Dependencies并"自动"添加它们来添加这些依赖项.Android Studio确实找到了库,并将它们添加到我的build.gradle中,但我仍然得到同样的错误......
这是我的build.gradle文件的一部分(依赖项位于底部):
import java.util.regex.Pattern
apply plugin: 'android'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0+'
}
}
ext.multiarch=false
android {
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
defaultConfig {
versionCode Integer.parseInt("" + getVersionCodeFromManifest() + "0")
}
compileSdkVersion 21
buildToolsVersion "21.0.0"
if (multiarch || System.env.BUILD_MULTIPLE_APKS) {
productFlavors {
armv7 {
versionCode …Run Code Online (Sandbox Code Playgroud) 我正在开发带有通知系统的 android 应用程序,我需要 android 设备使用我存储在资产文件夹中的特定声音推送通知,这是我的通知 java 代码:
Notification noti = new Notification.Builder(MainActivity.this)
.setTicker("Calcupital")
.setContentTitle("Calcupital")
.setContentText("User Information has been updated successfully")
.setSmallIcon(R.drawable.login)
.setContentIntent(pIntent).getNotification();
noti.flags = Notification.FLAG_AUTO_CANCEL;
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
notificationManager.notify(0, noti);
Run Code Online (Sandbox Code Playgroud)
假设我的声音是这样存储的:(\assets\hopo.mp3)
如何通过更改 Android 设备提供的列表中的声音,在不更改其他应用程序的推送通知系统的情况下,使用此声音推送此通知!!
我希望我的问题对你来说很清楚:)
我可以在我的应用程序中使用graph-api获取应用程序范围的用户ID.然后,如何在android中使用app-scoped id打开facebook messenger聊天窗口.
我们可以使用global-facebook-id(使用intent和uri)打开facebook messenger聊天窗口.
Uri uri = Uri.parse("fb-messenger://user/");
uri = ContentUris.withAppendedId(uri, Long.parseLong(peopleId));
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)
但是,使用app-scoped-id获取global-facebook-id是不可能的.
然后,我想知道如何使用app-scoped-id打开facebook messenger聊天窗口.我不需要发送私信,只需要打开即可.
谢谢你的阅读!
我正在编写将 Pascal 转换为 C 的程序,需要一些帮助。我从扫描仪生成器 Flex 开始。我定义了一些规则并创建了或多或少工作正常的扫描仪。它将 Pascal 语法分解为标记,目前它只打印它发现的内容。但我不知道接下来该怎么做。有没有涉及这个主题的文章或书籍?你下一步怎么做?
我想检查使用Android应用程序的设备中是否启用了蓝牙.我使用了.isEnabled方法.但是有一个错误.我发现(通过注释行)错误是在.isEnabled方法中.你能帮我解决这个问题吗?
final BluetoothAdapter bluetooth = BluetoothAdapter.getDefaultAdapter();
submitButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String status = "Bluetooth";
if(bluetooth != null) {
if (bluetooth.isEnabled()) {
String mydeviceaddress = bluetooth.getAddress();
String mydevicename = bluetooth.getName();
status = ("Address "+ mydeviceaddress + " Name" + mydevicename);
Toast.makeText(getApplicationContext(), "" + status + "", Toast.LENGTH_LONG).show();
} else {
status = ("Bluetooth not enabled");
Toast.makeText(getApplicationContext(), "" + status + "", Toast.LENGTH_LONG).show();
}
} else {
Toast.makeText(getApplicationContext(), "" + status + "", Toast.LENGTH_LONG).show();
}
}
}
Run Code Online (Sandbox Code Playgroud) 我想检查我的 imageview 的背景,如果它等于我的 drawable 文件夹中的一些 drawable 就做某事。我怎样才能做到这一点?我试过这段代码,但没有答案:
layoutRoot.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
if (view.getBackground() == R.drawable.grid_single_bg_selected) {
//Do sth
}
}
});
Run Code Online (Sandbox Code Playgroud) 我想使用数字日期选择器对话框和时间戳对话框,我已经写了代码,我的选择器对话框正在工作,但我希望它们采用其他格式.
这是我的代码:
public void onClick(View v) {
int id = v.getId();
switch(id){
case R.id.linearDate: {
DatePickerDialog dp = new DatePickerDialog(this, new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
mDatetext.setText(dayOfMonth+"-"+monthOfYear+"-"+year);
}
},year,month,day);
dp.show();
}break;
case R.id.linearTime: {
TimePickerDialog Tp = new TimePickerDialog(this, new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
mTimetext.setText(hourOfDay+ ":" +minute);
}
},hour,min,false);
Tp.show();
}break;
case R.id.linearPlace:{ startActivityForResult(new Intent(this,Location.class),CITY);
}break;
}
}
Run Code Online (Sandbox Code Playgroud) 如何在 中的项目之间显示垂直和水平分隔线LazyVerticalGrid?
因为LazyColumn可以这样做:
LazyColumn(...) {
items(items) { item ->
Row(item)
Divider()
}
}
Run Code Online (Sandbox Code Playgroud)
它也适用LazyVerticalGrid,但我不确定如何显示项目之间的垂直分隔线?