在java那里有SchemaFactory用于模式验证的类,但它在android中不可用.还有其他选择吗?
我正在尝试编写一个在运行时将某些内容复制到/ system分区的应用程序.我已经实现了通过请求SU权限以root身份运行终端命令的功能.我可以成功运行很多命令(在用SuperUser授予权限请求之后).但是,当我尝试将/ system重新安装为读/写时,没有任何反应.我没有收到错误或崩溃,并且命令看起来很好,但分区保持为只读.这是我正在运行的命令(Droid X):, mount -o rw,remount -t ext3 /dev/block/mmcblk1p21 /system如果我从终端运行相同的命令,它的工作正常.这是我的应用程序中执行root命令的代码:
String cmd = "mount -o rw,remount -t ext3 /dev/block/mmcblk1p21 /system";
Process p = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(p.getOutputStream());
os.writeBytes(cmd + "\n");
os.writeBytes("exit\n");
os.flush();
Run Code Online (Sandbox Code Playgroud)
然后我有一些代码检查stdout和stderr流,看看发生了什么.任何人都可以告诉我为什么这不起作用?
所以我已经尝试了几天将android平台添加到我的项目中,但我一直在终端中得到这个响应.(使用OSX,Phonegap 3.3.0)
Creating android project...
/usr/local/lib/node_modules/cordova/node_modules/q/q.js:126
throw e;
^
Error: An error occured during creation of android sub-project.
/Users/XerxesNoble/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:126
throw e;
^
Error: The command "android" failed. Make sure you have the latest Android SDK installed, and the "android" command (inside the tools/ folder) is added to your path.
at /Users/XerxesNoble/.cordova/lib/android/cordova/3.3.0/bin/lib/check_reqs.js:85:29
at _rejected (/Users/XerxesNoble/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:808:24)
at /Users/XerxesNoble/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:834:30
at Promise.when (/Users/XerxesNoble/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:1079:31)
at Promise.promise.promiseDispatch (/Users/XerxesNoble/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:752:41)
at /Users/XerxesNoble/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:574:44
at flush (/Users/XerxesNoble/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:415:13)
at /usr/local/lib/node_modules/cordova/src/platform.js:244:30
at ChildProcess.exithandler (child_process.js:641:7)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用facebook SDK使用以下方法从我的iOS原生应用程序向Facebook好友发送App邀请.
-(IBAction)ShowFiendDialog:(id)sender
{
NSDictionary *parameters = @{@"to":@""};
[FBWebDialogs presentRequestsDialogModallyWithSession:FBSession.activeSession
message:@"my message"
title:@"my title"
parameters:parameters
handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error)
{
if(error)
{
NSLog(@"Some errorr: %@", [error description]);
UIAlertView *alrt = [[UIAlertView alloc] initWithTitle:@"Invitiation Sending Failed" message:@"Unable to send inviation at this Moment, please make sure your are connected with internet" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alrt show];
//[alrt release];
}
else
{
if (![resultURL query])
{
return;
}
NSDictionary *params = [self parseURLParams:[resultURL query]];
NSMutableArray *recipientIDs = [[NSMutableArray alloc] …Run Code Online (Sandbox Code Playgroud) 我需要在Phonegap应用程序中提供一些帮助.
CordovaWebView我的应用程序中有一个.我需要从我的html(根据jQuery Mobile页面结构有多个页面)加载一个特定的页面,所以我这样使用loadUrl:
cWebView.loadUrl("file:///android_asset/www/index.html#some-page-id");
Run Code Online (Sandbox Code Playgroud)
这很好用.我能够看到some-page-id.
现在我需要补充WebViewClient的cWebView.如果我这样做,我收到错误,并且webl中没有加载网址.
码:
cWebView.setWebViewClient(new MyCordovaWebViewClient(this, cWebView));
public class MyCordovaWebViewClient extends CordovaWebViewClient {
public MyCordovaWebViewClient(CordovaInterface cordova,
CordovaWebView view) {
super(cordova, view);
// TODO Auto-generated constructor stub
}
@Override
public void onPageFinished(WebView view, String url) {
// TODO Auto-generated method stub
Log.d(TAG, "my page finished " + url);
super.onPageFinished(view, url);
}
}
Run Code Online (Sandbox Code Playgroud)
错误:
Application Error: A network error occurred. (file:///android_asset/www/index.html#some-page-id)
Run Code Online (Sandbox Code Playgroud)
如果我只是加载index.html,而没有给出具体的页面ID,那么我就不会遇到任何问题setWebViewClient.
任何setWebViewClient与特定页面ID 一起使用的解决方案?
在eclipse中,m2eclipse插件会在我构建maven2项目时提示我输入凭据.它编译得很好.
但是,如果我现在尝试从命令行运行"mvn install",我会收到一个找不到工件的错误.如何将用户名/密码添加到我的pom.xml中以解决此问题.
我试图通过单击自己将图像按钮旋转到360但它不起作用
我正在使用像这样的xml文件..
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="72dp"
android:layout_height="72dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="83dp"
android:layout_marginTop="103dp"
android:clickable="true"
android:src="@drawable/cute" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
和这样的java代码......
package com.example.testapplication;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.RotateAnimation;
import android.widget.ImageButton;
public class MainActivity extends Activity implements OnClickListener {
ImageButton img;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
img = (ImageButton) findViewById(R.id.imageView1);
}
public void onClick(View v) {
// TODO Auto-generated method stub
RotateAnimation ra =new RotateAnimation(0, 360);
ra.setFillAfter(true);
ra.setDuration(0);
img.startAnimation(ra);
}
}
Run Code Online (Sandbox Code Playgroud)
我的应用目标是使用9 img …
我有两个链接,例如:说facebook.com和m.facebook.com.如果是Android手机,我想
打开m.facebook.com.如果是Android平板电脑,我想打开facebook.com链接.我想做的
webview.怎么可能?
我的列表视图行的xml代码是
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="5"
android:orientation="vertical" >
<TextView
android:id="@+id/tv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp" />
<TextView
android:id="@+id/tv_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_weight="2"
android:gravity="center" >
<ImageView
android:id="@+id/iv_image"
android:layout_width="50dp"
android:layout_height="40dp"
android:background="@drawable/app_icon_17"
android:contentDescription="@string/empty" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_weight="2"
android:gravity="center" >
<Button
android:id="@+id/btn_delete"
android:layout_width="40dp"
android:layout_height="40dp"
android:background="@drawable/btn_delete_new"
android:focusable="false" />
</LinearLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
我希望id为btn_delete的最后一个按钮保持右对齐.并且它在设计时以"图形布局"的形式显示.但是当我运行它时,在模拟器上它不起作用.
看输出:

那么为什么删除按钮没有正确对齐?
android gravity android-layout android-linearlayout layout-gravity