text = text + CepVizyon.getPhoneCode() + "\n\n"
+ getText(R.string.currentversion) + CepVizyon.getLicenseText();
activationText.setText(text);
myTextView.setText(text);
Run Code Online (Sandbox Code Playgroud)
我想改变CepVizyon.getPhoneCode()字符串的颜色.我怎样才能做到这一点?
首先,我在Main Activity中编写了一些方法,但我认为它们应该是一个类.
这是我的代码... openFileOutput和openFileInput是未定义的.任何的想法??也许它应该是服务或活动......?
package spexco.hus.system;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Date;
import spexco.hus.cepvizyon.CepVizyon;
import android.content.Context;
public class LicenseIDB {
private String PHONECODEFILE = "CepVizyonCode";
private static String PhoneCode = null;
public LicenseIDB() {
if (readLocal(PHONECODEFILE, 8) == null)
createSystemCode();
}
public static long getDate() {
Date currentTime = new Date();
return currentTime.getTime();
}
public void createSystemCode() {
long date = getDate();
String str = Integer.toHexString(Integer.MAX_VALUE - (int) date);
for (int i = str.length(); i < …Run Code Online (Sandbox Code Playgroud) 我想问一下,使用两个或多个嵌套的RelativeLayout.第一个代码看起来像图片1,当我添加android:layout_alignParentRight="true"第二个RelativeLayout时,这看起来像图片2.我想将文本对齐到第二个RelativeLayout.我的错在哪里?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:background="@drawable/background"
android:layout_height="wrap_content"
android:id="@+id/testRL">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:id="@+id/testRotateLL"
android:background="@drawable/picture_border_offer_first_page">
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="7000TL"
android:textSize="15sp"
android:textColor="@android:color/white"
android:id="@+id/amountLayoutTV" />
</RelativeLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
图片1:

我补充说 android:layout_alignParentRight="true"
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:background="@drawable/background"
android:layout_height="wrap_content"
android:id="@+id/testRL">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:id="@+id/testRotateLL"
android:background="@drawable/picture_border_offer_first_page">
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="7000TL"
android:layout_alignParentRight="true"
android:textSize="15sp"
android:textColor="@android:color/white"
android:id="@+id/amountLayoutTV" />
</RelativeLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
图2:

我正在使用OPENCV开发一个项目.我在onCameraFrame上有一些过程.虽然它显示预览,但用户可以拍照.但在某些设备中,我在调用takePicture(...)方法后出错.我该怎么办?
E/Camera-JNI(11783): Manually set buffer was too small! Expected 539380 bytes, but got 460800!
Run Code Online (Sandbox Code Playgroud)
新症状:此缓冲区的大小是我的帧大小460800.我在onCameraFrame上记录了帧大小.每帧的大小都是460800.据我了解,takePicture尝试使用预览缓冲区.他们的尺寸不同.
我需要旋转一个布局(有一个TextView和ImageView),它应该在RelativeLayout中右对齐和顶部对齐.我创建了我的布局,这个布局放在右上角.但如果我旋转它我不能正确对齐.我该怎么办?
我的相对布局
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:background="@drawable/background"
android:layout_height="wrap_content"
android:id="@+id/testRL">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:id="@+id/testRotateLL">
<ImageView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:background="@drawable/picture_border_offer_first_page" />
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="7000TL"
android:textSize="15sp"
android:layout_centerInParent="true"
android:textColor="@android:color/white"
android:id="@+id/amountLayoutTV" />
</RelativeLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
然后我用动画旋转这个linearLayout.旋转好,..
<rotate
xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0"
android:toDegrees="45"
android:pivotX="50%"
android:pivotY="50%"
android:fillEnabled="true"
android:detachWallpaper="true"
android:duration="0"
android:fillAfter="true">
</rotate>
Run Code Online (Sandbox Code Playgroud)
旋转新视觉后...

我在我的应用程序上连接到两台服务器(PROD是https,测试服务器是http).
在J2ME上:我可以毫无问题地连接到这两台服务器.在Android上我无法连接到测试服务器.当连接是http时,如果我不使用setChunkedStreamingMode,我不能得到,responseCode(StringIndexOutOfBoundsException);如果我使用setChunkedStreamingMode,响应代码是401.我该怎么办,我的错在哪里?
这是我的android代码,如果你想看J2me代码,我也可以添加它.
URL url = new URL(getUrl());
URLConnection conn = url.openConnection();
HttpURLConnection httpConn = (HttpURLConnection) conn;
httpConn.setAllowUserInteraction(false);
httpConn.setInstanceFollowRedirects(true);
httpConn.setConnectTimeout(10000);
httpConn.setRequestProperty("User-Agent", util.getDeviceFullModel()
+ " " + util.getSoftwareVersion());
httpConn.setRequestProperty("Accept-Charset", "utf-8");
httpConn.setRequestProperty("Content-Type",
"text/xml; charset=utf-8");
httpConn.setRequestProperty("SOAPAction",
"http://tempuri.org/IAuthenticationServiceForGroup/"+conTypeString);
httpConn.setRequestProperty("Software-Version", AppData.VERSION);
httpConn.setChunkedStreamingMode(getParams().getBytes("UTF8").length);
httpConn.setRequestMethod("POST");
httpConn.setDoOutput(true);
httpConn.setDoInput(true);
httpConn.connect();
os = httpConn.getOutputStream();
os.write(getParams().getBytes("UTF8"));
try {
os.close();
} catch (Exception e) {
onError(e);
}
response=httpConn.getResponseCode();
Run Code Online (Sandbox Code Playgroud)
J2ME代码:
HttpConnection c = (HttpConnection)XConnection.openConnection(XConnection.SERVER + "AuthenticationServiceForGroup.svc");
c.setRequestProperty("User-Agent", XUtil.getDeviceFullModel() + " " + XUtil.getSoftwareVersion());
c.setRequestProperty("Content-Type", "text/xml; …Run Code Online (Sandbox Code Playgroud) 我有一个处理配置更改的活动.但现在我必须改变布局.我尝试在onConfigurationChanged回调中再次设置布局并希望得到正确的布局(土地),但它仍然显示纵向视图的第一个布局(有两个布局(同名)放置在res/layout和res/layout-land :)
如果我删除android:configChanges ="orientation",它应该是,但是需要处理onConfigurationChanged.我该怎么办??
我可以在Android 上的dalvik VM上运行C代码吗?
VM运行字节代码,但我需要在dalvik-VM上为myApps运行c代码.可能吗??
我一直在尝试创建一个架构。它代表我的对象,就像{name:"Joe Doe", id:"1234567890"}But 在创建新对象的第一个请求上;它不应该在对象中包含 id 参数。否则它可能意味着对消费者的更新......
您对实现它的最佳方法有什么想法吗?
我需要什么作为 joi 架构;
joi.object().keys({
id: joi.string().forbidden() or required(),
name: joi.string(),
...
Run Code Online (Sandbox Code Playgroud)
样品请求;
创建:
POST请求...'api/v1/item/'
目的 : {name:"Joe Doe"}
更新:
PUT请求...'api/v1/item/'
目的 : {id:"1234567890", name:"Joe Doe"}
我有CameraList类提供Cameras列表,如"SONY","VIVOTEK","VIVOTEK 7XXX","PIXORD","TOSHIBA","JVC E-CON"......
我想在我的微调器中列出它们,但我不能.有我的代码..
public class AddCam extends MainActivity {
CameraList cams = new CameraList();
@Override
public void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
Toast msg = Toast.makeText(AddCam.this, getString(R.string.add_new), Toast.LENGTH_LONG);
msg.setGravity(Gravity.CENTER, msg.getXOffset() / 2, msg.getYOffset() / 2);
String a = getString(R.string.add_new);
TextView tv = (TextView) findViewById(R.id.head);
tv.setText(getString(R.string.add_new));
Spinner s = (Spinner) findViewById(R.id.spinner);
ArrayAdapter<?> adapter = ArrayAdapter.createFromResource(
this, R.array.cameras, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
//s.setAdapter(adapter); **** there is null po?nter ex.
setContentView(R.layout.spinnerex);
}
}
Run Code Online (Sandbox Code Playgroud)
我的camlist代码是
public class CameraList {
private static …Run Code Online (Sandbox Code Playgroud) 我需要将Activity更改为ListActivity.但是我无法启动我的项目...是否需要更改manifest.xml?
或者我如何将屏幕从Activity更改为ListActivity?有什么不同startActivity(new Intent(this, list.class))吗?
10-05 17:34:54.722: ERROR/AndroidRuntime(11550): java.lang.RuntimeException: Unable to start activity ComponentInfo{spexco.hus.cepvizyon/spexco.hus.cepvizyon.CepVizyon}: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
10-05 17:34:54.722: ERROR/AndroidRuntime(11550): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
10-05 17:34:54.722: ERROR/AndroidRuntime(11550): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
10-05 17:34:54.722: ERROR/AndroidRuntime(11550): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
10-05 17:34:54.722: ERROR/AndroidRuntime(11550): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
10-05 17:34:54.722: ERROR/AndroidRuntime(11550): at android.os.Handler.dispatchMessage(Handler.java:99)
10-05 17:34:54.722: ERROR/AndroidRuntime(11550): at android.os.Looper.loop(Looper.java:123)
10-05 17:34:54.722: ERROR/AndroidRuntime(11550): at android.app.ActivityThread.main(ActivityThread.java:4363)
10-05 17:34:54.722: ERROR/AndroidRuntime(11550): at java.lang.reflect.Method.invokeNative(Native Method)
10-05 17:34:54.722: ERROR/AndroidRuntime(11550): at java.lang.reflect.Method.invoke(Method.java:521)
10-05 17:34:54.722: ERROR/AndroidRuntime(11550): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
10-05 17:34:54.722: …Run Code Online (Sandbox Code Playgroud) 我需要开发一个有两个标签的按钮.
我找到一些关于自定义视图的好文章,但我无法想象如何创建一个myButton类(其中包含自定义布局)扩展按钮...是否可能..
另外在XML中有些视图,布局......我们怎么能这样做?
10-18 10:26:39.382: ERROR/global(13919): Deprecated Thread methods are not supported.
10-18 10:26:39.382: ERROR/global(13919): java.lang.UnsupportedOperationException
10-18 10:26:39.382: ERROR/global(13919): at java.lang.VMThread.stop(VMThread.java:85)
10-18 10:26:39.382: ERROR/global(13919): at java.lang.Thread.stop(Thread.java:1379)
10-18 10:26:39.382: ERROR/global(13919): at java.lang.Thread.stop(Thread.java:1344)
10-18 10:26:39.382: ERROR/global(13919): at spexco.hus.camera.Camera.cancel(Camera.java:273)
10-18 10:26:39.382: ERROR/global(13919): at spexco.hus.cepvizyon.ViewCam.onStop(ViewCam.java:83)
10-18 10:26:39.382: ERROR/global(13919): at android.app.Instrumentation.callActivityOnStop(Instrumentation.java:1169)
10-18 10:26:39.382: ERROR/global(13919): at android.app.Activity.performStop(Activity.java:3797)
10-18 10:26:39.382: ERROR/global(13919): at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3416)
10-18 10:26:39.382: ERROR/global(13919): at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3487)
10-18 10:26:39.382: ERROR/global(13919): at android.app.ActivityThread.access$2800(ActivityThread.java:119)
10-18 10:26:39.382: ERROR/global(13919): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1896)
10-18 10:26:39.382: ERROR/global(13919): at android.os.Handler.dispatchMessage(Handler.java:99)
10-18 10:26:39.382: ERROR/global(13919): at android.os.Looper.loop(Looper.java:123)
10-18 10:26:39.382: …Run Code Online (Sandbox Code Playgroud) android ×12
android-ndk ×1
custom-view ×1
dalvik ×1
express ×1
http-error ×1
java-me ×1
javascript ×1
joi ×1
listactivity ×1
node.js ×1
opencv ×1
textview ×1
uitextview ×1
validation ×1
view ×1