目前我正在开展一个项目来管理我的燃料成本.现在我尝试传递2个参数,Form::open()其中遗憾的是不起作用.我认为我需要一次传递2个参数的原因是因为我的网址是Sitename/car/{id}/tank/{id}
我做错了什么?
edit.blade.php
Form::open(array('class' => 'form-horizontal', 'method' => 'put', 'action' => array('TankController@update', array($aid, $id))))
Run Code Online (Sandbox Code Playgroud)
问题代码
'action' => array('TankController@update', array($aid, $id)
Run Code Online (Sandbox Code Playgroud)
- 结果出现以下错误:
Parameter "tank" for route "car.{id}.tank.update" must match "[^/]++" ("" given) to generate a corresponding URL.
TankController.php
public function edit($id, $tid)
{
$tank = Tank::find($tid);
if(!$tank) return Redirect::action('TankController@index');
return View::make('Tank.edit', $tank)->with('aid', $id);
}
public function update($id, $tid)
{
$validation = Validator::make(Input::all(), Tank::$rules);
if($validation->passes()){
$tank = Tank::find($tid);
$tank->kmstand = Input::get('kmstand');
$tank->volume = Input::get('volume');
$tank->prijstankbeurt = Input::get('prijstankbeurt');
$tank->datumtank …Run Code Online (Sandbox Code Playgroud) 我能够使用google plus登录并获取我谷歌加圈子中所有人的列表但现在我还想获得我圈子中所有人的电子邮件地址是否有办法做到这一点?我尝试过这段代码,但它不起作用.
public void onPeopleLoaded(ConnectionResult status, final PersonBuffer personBuffer,
String nextPageToken)
{
if (status.getErrorCode() == ConnectionResult.SUCCESS)
{
try
{
//Add all friends ids in an arraylist
int count = personBuffer.getCount();
//Loop through all the ids of google plus friends
for (int i = 0; i < count; i++)
{
//mListItems.add(personBuffer.get(i).getDisplayName());
//mListIds.add(personBuffer.get(i).getId());
friends_gplus_Ids += personBuffer.get(i).getId() + ",";
//Log.d("Emails", personBuffer.get(i).getOrganizations().toString());
//personBuffer.get(i).getEmails().size();
if((personBuffer.get(i).getEmails().size() > 0))
{
Log.d("Emails", personBuffer.get(i).getEmails().get(0).toString());
}
else
{
Log.d("Emails", "Null");
}
}
}
finally
{
personBuffer.close();
}
}
Run Code Online (Sandbox Code Playgroud) 现在我正在使用HTTPRequest,每件事都运行正常.但我想处理以下情况
Device is connected to wifi but wifi is not connected to internet
我正在使用连接超时,但说实话,它需要自己的时间超时,这是40秒不小于那个.请求代码如下:
public String[] doHttpGetWithCode_1(String url, String headerParam) throws Exception {
weburl = new URL(url);
uri = new URI(weburl.getProtocol(), weburl.getUserInfo(), weburl.getHost(), weburl.getPort(), weburl.getPath(), weburl.getQuery(), weburl.getRef());
result = new String[2];
httpParameters = new BasicHttpParams();
// Set the timeout in milliseconds until a connection is established.
timeoutConnection = 3000;
HttpConnectionParams.setConnectionTimeout(httpParameters, timeoutConnection);
// Set the default socket timeout (SO_TIMEOUT)
// in milliseconds which is the timeout for waiting for data.
timeoutSocket …Run Code Online (Sandbox Code Playgroud) 我之间有困惑
intent.getSerializableExtra (String name)
Run Code Online (Sandbox Code Playgroud)
和
intent.getExtras().getSerializable (String key)
Run Code Online (Sandbox Code Playgroud)
我们可以互换使用它们,还是两者都有自己特定的场景?如果是这样,当我们可以使用getSerializableExtra (String name)
以及什么时候可以使用时,这些场景是什么getExtras().getSerializable (String key)?
我正在开发Android MapView和开发基于地图的应用程序.我需要找到特定的X距离Co-ordinates.方向不是我的优先考虑距离是我的优先考虑我需要找到距离特定位置100米的任何想法,我该怎么做才能提前感谢阅读和回答.
我试图正确地证明我正在使用.Net程序中的ZPL进行打印的条形码.这是我目前的代码:
^FO10,50^FB500,1,0,R,0^AO,40,40^BY3^BCN,100,Y,N,N^FD1234567^FS^XZ
Run Code Online (Sandbox Code Playgroud)
使用条形码时,字段块似乎被忽略,但对于文本,它可以正确地证明它是正确的.有任何想法吗?
我正在使用Smack构建一个应用程序.在Eclipse模拟器中运行app后,apk安装成功,但似乎没有响应.点击它后,我收到警报"不幸的是,应用程序停止工作".请帮我解决一下.Logcat:
01-13 05:55:17.117: E/AndroidRuntime(1067): FATAL EXCEPTION: main
01-13 05:55:17.117: E/AndroidRuntime(1067): Process: com.demo.xmppchat, PID: 1067
01-13 05:55:17.117: E/AndroidRuntime(1067): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.demo.xmppchat/com.demo.xmppchat.CustomizedListView}: java.lang.NullPointerException
01-13 05:55:17.117: E/AndroidRuntime(1067): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2176)
01-13 05:55:17.117: E/AndroidRuntime(1067): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2226)
01-13 05:55:17.117: E/AndroidRuntime(1067): at android.app.ActivityThread.access$700(ActivityThread.java:135)
01-13 05:55:17.117: E/AndroidRuntime(1067): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1397)
01-13 05:55:17.117: E/AndroidRuntime(1067): at android.os.Handler.dispatchMessage(Handler.java:102)
01-13 05:55:17.117: E/AndroidRuntime(1067): at android.os.Looper.loop(Looper.java:137)
01-13 05:55:17.117: E/AndroidRuntime(1067): at android.app.ActivityThread.main(ActivityThread.java:4998)
01-13 05:55:17.117: E/AndroidRuntime(1067): at java.lang.reflect.Method.invokeNative(Native Method)
01-13 05:55:17.117: E/AndroidRuntime(1067): at java.lang.reflect.Method.invoke(Method.java:515)
01-13 05:55:17.117: E/AndroidRuntime(1067): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
01-13 05:55:17.117: E/AndroidRuntime(1067): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593) …Run Code Online (Sandbox Code Playgroud) 是否可以在SwipeRefreshLayout不显示进度微调器的情况下执行功能.现在它的工作完全没有拉动刷新的默认行为显示进度微调器,onRefresh()我隐藏它.但我想将它们全部隐藏起来只是想使用pull来刷新功能但没有进度微调器.
在我的启动画面中,我向服务器请求,但是当没有互联网连接时,我正在打开
Intent settingsIntent = new Intent(Settings.ACTION_SETTINGS);
startActivityForResult(settingsIntent, REQUEST_ENABLE_CONNECTION);
Run Code Online (Sandbox Code Playgroud)
但问题是onActivityResult使用requestCode =立即调用REQUEST_ENABLE_CONNECTION
我也试图为FLAG_NEW_TASK没有运气的意图添加标志.
活动不是 singleTop或singleInstance在manifest.
什么是解决此问题的最佳Android解决方案?我不想使用广播,因为它不是我流量的最佳方式,所以它将作为我的最后选择.
非常感谢您的帮助.
我想使用自定义对话框进行引脚验证.这是我的代码:
public void fetchUI()
{
add=(Button)findViewById(R.id.pinButton);
add.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
final AlertDialog.Builder alert = new AlertDialog.Builder(MainActivity.this);
final EditText input = new EditText(MainActivity.this);
input.setTransformationMethod(PasswordTransformationMethod.getInstance());
alert.setView(input);
alert.setTitle("Type Your PIN");
alert.setIcon(R.drawable.ic_launcher);
alert.setMessage("Please Type Your PIN below to Authenticate");
alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
}
});
alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
dialog.cancel();
}
});
alert.show();
}
});
}
Run Code Online (Sandbox Code Playgroud)
现在我想这样做:如果我用正确的PIN点击OK,那么对话框就会消失.否则,如果我点击OK,它就不会消失.我怎样才能做到这一点?任何帮助将不胜感激.
我有一个类似这样的字符串:
[ { "1":33 }, { "2":30 }, { "3":15 }, { "4":23 }, ...{ "9":17 },... { "U":2 }, { "V":22 }, { "W":1 }, { "X":35 }, { "Y":6 }, { "Z":19 } ]
结构是{"key":value}.我需要将其转换为表/ HashMap,以便我可以根据键获取值.
我尝试使用Gson但失败了.有没有比使用某些序列化更简单的方法呢?
TIA
是否有任何人指导我,为什么导致String从Spanable使用用户自定义颜色color.xml不会导致低于预期的结果示例代码
sorry_Span=new SpannableString("Sorry, you dont have any registered device, what you want to do ?");
sorry_Span.setSpan(new ForegroundColorSpan(Color.BLUE), 36, 42, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
//sorry_Span.setSpan(new ForegroundColorSpan(R.color.blue_txt), 36, 42, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
sorry_Msg.setText(sorry_Span);
Run Code Online (Sandbox Code Playgroud)
当Color.Blue它运行时,它的结果很好,但是当R.color.blue_txt它运行时它的空白文本在此先感谢您的帮助
android ×10
colors ×1
dialog ×1
distance ×1
google-maps ×1
google-plus ×1
httprequest ×1
httpresponse ×1
java ×1
json ×1
laravel ×1
laravel-4 ×1
location ×1
performance ×1
php ×1
progress ×1
regex ×1
timer ×1
zpl ×1
zpl-ii ×1