有人把这个移植到android了吗?比着色器更多的框架.像将相机数据带入的东西openGL.我已经使用它iOS,它非常快.任何帮助深表感谢.
我正在制作一个Android应用程序.我正在制作一个在用户检查时始终在后台运行的服务,并且在用户使用checkbox时应该停止unckeck.所以,它的工作,当我检查了盒子里,还出现了"服务启动"吐司,但是当我uncheck的checkbox话,就说明,上面写着"停止服务"的烤面包,但它并没有停止播放时,该服务已启动,其启动的声音.阻止这种声音的唯一方法是关闭我的手机,然后打开它.
这是我启动和停止服务的java代码
public int onStartCommand(Intent intent, int flags, int startId) {
Toast.makeText(this, "Service Started", Toast.LENGTH_LONG).show();
this.registerReceiver(this.batteryInfoReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
return START_STICKY;
}
public void onDestroy() {
super.onDestroy();
Toast.makeText(this, "Service Stopped", Toast.LENGTH_LONG).show();
}
Run Code Online (Sandbox Code Playgroud)
这是我的xml文件
<CheckBoxPreference
android:title="Enable/Disable Alarm"
android:defaultValue="true"
android:key="cbAlarm"
android:summary="Enable or disable alarm" />
Run Code Online (Sandbox Code Playgroud)
这是我的logcat
05-06 09:13:53.230: D/dalvikvm(5351): GC_EXTERNAL_ALLOC freed 39K, 50% free 2725K/5379K, external 0K/0K, paused 124ms
05-06 09:13:53.355: D/dalvikvm(5351): GC_EXTERNAL_ALLOC freed 21K, 49% free 2779K/5379K, external 504K/518K, paused 18ms
05-06 09:13:53.420: D/CLIPBOARD(5351): …Run Code Online (Sandbox Code Playgroud) 我的LayoutInflater.Factory(下面的代码示例)调用onCreateView并使用'com.android.support:support-v4:22.0.0'正常工作的主要问题.但是onCreateView当我转到'com.android.support:support-v4:22.1.0'或更高版本时,不会调用它.我不明白为什么?
//From many fragments i Call hintManager.inflate
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup viewGroup, Bundle savedInstanceState) {
layout = hintManager.inflate(inflater, R.layout.generate_code);
...
//here is HintManager method called from various fragments.
public View inflate(LayoutInflater inflater, int layoutResourceId) {
AttributeParser attributeParser = new AttributeParser();
LayoutInflater layoutInflater = attributeParser.getLayoutInflater(inflater);
final View v = layoutInflater.inflate(layoutResourceId, null);
//here AttributeParserFactory#onCreateView should be called, but it fails with 22.1+ support lib, but works with 22.0
attributeParser.setViewAttribute(v);
return v;
}
...
//example …Run Code Online (Sandbox Code Playgroud) 我正在尝试从Robolectric.org的Writing Your First Test页面进行测试.有问题的测试看起来像这样:
@Test
public void clickingLogin_shouldStartLoginActivity() {
WelcomeActivity activity = Robolectric.setupActivity(WelcomeActivity.class);
activity.findViewById(R.id.login).performClick();
Intent expectedIntent = new Intent(activity, WelcomeActivity.class);
assertThat(shadowOf(activity).getNextStartedActivity()).isEqualTo(expectedIntent);
}
Run Code Online (Sandbox Code Playgroud)
我得到这个编译错误:Cannot resolve method 'assertThat(android.content.Intent).
我看到用于导入此方法的两种可能性是,org.hamcrest.MatcherAssert.assertThat并且org.junit.Assert.assertThat,这两种方法都没有assertThat像本Robolectric测试中使用的单参数方法.
我的应用程序build.gradle有这些依赖项:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
testCompile "org.robolectric:robolectric:3.0"
testCompile 'junit:junit:4.12'
}
Run Code Online (Sandbox Code Playgroud)
这个测试使用什么框架/库?
我无法在android studio上设置firebase的更新版本.我已经在站点firebase上创建了项目的json文件,并将其复制到项目中并在gradle中处理行后:
buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:3.0.0'
}
}
apply plugin: 'com.android.application'
android {
// ...
}
dependencies {
compile 'com.google.firebase:firebase-core:9.0.1'
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
failed to resolve: compile 'com.google.firebase:firebase-core:9.0.0'
我该如何解决?
我正在视图持有者/适配器模式之后创建"文档"的网格视图.在活动中,我从网络类中获得回调,因此我需要能够在不同的时间更新每个网格单元.
我这样做的方法是通过从对象元素(文档)到相应的视图持有者的映射映射.我需要这样做,因为适配器正在循环使用单元格,所以有时我可以收到一个回调来更新一个不可见的单元格,在这种情况下,回调信息将被忽略.
我可以看到getView适配器的方法被多次调用为位置0.我一直在读这是正常的.
inflating position 0 *** progressBar 1
recycling position 0
recycling position 0
inflating position 0 *** progressBar 2
recycling position 0
recycling position 0
recycling position 0
recycling position 0
recycling position 0
recycling position 0
Run Code Online (Sandbox Code Playgroud)
UI我需要从回调中更新的一个元素是一个进度条,我通过添加viewHolder到与文档关联的Map来跟踪.
除了第一个方法之外,这整个方法适用于所有位置.我可以识别的唯一区别是这些多次调用,getView所以我从那里开始调试.在progressBar我更新为" progressBar2",这是最新的geView夸大,但实际上它并没有给回应setVisible(View.VISIBLE).然后我对代码进行了一些更改以更新" progressBar1"并且它可以工作.
这意味着getView相同位置膨胀两次,但第二次没有被使用或显示.
我能做错什么?为什么progressbar1工作而progressbar2没有?我希望这getView会给我一个与职位相对应的最新观点.
谢谢.
适配器:
public class DocumentPickerGridViewAdapter extends ArrayAdapter<Document> implements Filterable {
private final DocumentPickerGridViewController picker;
private ArrayList …Run Code Online (Sandbox Code Playgroud) 我正在尝试哈希一个BigInteger/BigNum,我在Android/iOS上得到了不同的结果.我需要获得相同的Hash结果,以便两个应用程序按照SRP协议工作.仔细观察它对正数很好,但不适用于负数(第一个半数大于7).不确定哪一个是正确的,哪一个要调整以匹配另一个.
安卓:
void hashBigInteger(String s) {
try {
BigInteger a = new BigInteger(s, 16);
MessageDigest sha = MessageDigest.getInstance("SHA-256");
byte[] b = a.toByteArray();
sha.update(b, 0, b.length);
byte[] digest = sha.digest();
BigInteger d = new BigInteger(digest);
Log.d("HASH", "H = " + d.toString(16));
} catch (NoSuchAlgorithmException e) {
throw new UnsupportedOperationException(e);
}
}
Run Code Online (Sandbox Code Playgroud)
iOS版:
void hashBigNum(unsigned char *c) {
BIGNUM *n = BN_new();
BN_hex2bn(&n, c);
unsigned char buff[ SHA256_DIGEST_LENGTH ];
int len = BN_num_bytes(n);
unsigned char * bin = (unsigned char *) malloc( …Run Code Online (Sandbox Code Playgroud) 我想在标记上打开信息窗口,即使在谷歌地图上指向另一个标记时仍保持打开状态.这是我的代码.
private void drawMarker(LatLng point, String pLoc){
// Creating an instance of MarkerOptions
MarkerOptions markerOptions = new MarkerOptions().icon(BitmapDescriptorFactory.fromResource(R.drawable.map_pin_green));
// Setting latitude and longitude for the marker
markerOptions.position(point);
markerOptions.title(pLoc);
// Adding the marker to the map
m_cGoogleMap.addMarker(markerOptions).showInfoWindow();
m_cGoogleMap.setInfoWindowAdapter(new MarkerInfoWindowAdapter(null));
}
Run Code Online (Sandbox Code Playgroud)
我正在调用这个简单的方法来添加多个标记.使用该showInfoWindow()方法只需打开当前标记的信息窗口,但我希望信息窗口始终为当前和以前的标记(多个)保持打开状态.
请帮帮我!!
谢谢.
我使用了查看日历西班牙语,但我不确定如何更改语言,有些属性在任何地方都不可用。
现在我有这个:
<CalendarView
android:id="@+id/calendari"
android:layout_margin="10dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weekNumberColor="@color/botoCalendari"
android:focusedMonthDateColor="#d91f1f"
android:weekSeparatorLineColor="#1fd928"
android:selectedWeekBackgroundColor="#1fd9d6"
android:unfocusedMonthDateColor="#d91fd9"
/>
Run Code Online (Sandbox Code Playgroud)
是否有任何财产或代码?
非常感谢。
android ×10
java ×2
adapter ×1
biginteger ×1
bignum ×1
build ×1
build.gradle ×1
factory ×1
firebase ×1
google-maps ×1
gpuimage ×1
gradle ×1
gridview ×1
hash ×1
inflate ×1
infowindow ×1
ios ×1
robolectric ×1
unit-testing ×1