我不是开发人员,但我需要不时安装ruby工具.有人可以用简单的词语解释以下术语:
提前致谢
我似乎无法获得我的额外信息以及意图发送.意图正确加载下一个活动,但没有有效负载.
呼叫者:
//a list item was clicked
protected void onListItemClick(ListView l, View v, int position, long id)
{
super.onListItemClick(l, v, position, id);
Intent i = new Intent(this, ProgramTracks.class);
i.putExtra("_id", id);
startActivity(i);
}
Run Code Online (Sandbox Code Playgroud)
接收器:
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.program_tracks);
if( savedInstanceState != null )
{
mDateId = savedInstanceState != null ? savedInstanceState.getLong("_id") : null;
Toast.makeText(this, "ID " + mDateId, Toast.LENGTH_SHORT).show();
}
else
{
Toast.makeText(this, "Null!", Toast.LENGTH_SHORT).show();
}
}
Run Code Online (Sandbox Code Playgroud)
表现:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.site.android.app"
android:versionCode="1" android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" …Run Code Online (Sandbox Code Playgroud) 我想知道:为什么我们将"bundle"设置为"nil",当我们alloc-init一个viewController时?
例如:
MyViewController*viewController = [[MyViewController alloc] initWithNibName:@"MyViewController"bundle:nil];
谢谢
保罗
我正在使用Symfony 2开始一个新项目,我必须创建和管理一些具有许多个人信息的用户.我必须决定选择一种管理我们的方式,我希望收到一些关于选择Symfony 2基本实现或FOSUserBundle的建议.
我需要知道当前载波实例的宽度和高度
例如:
image_tag image.photo_url,:width => image.photo.width, :height => image.photo.height
Run Code Online (Sandbox Code Playgroud)
但问题是image.photo.width和image.photo.height不起作用.
有任何想法吗 ?
我有一个文件event_setup.sqlite放在我的应用程序中并复制到Copy Bundle ResourcesBuild Phases中的部分.
在将此文件从Resources复制到Documents Directory时,我的应用程序说无法找到该文件.我使用以下代码从资源中复制文件,并告诉我该文件不存在:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
[self checkAndCreateDatabase: @"event_setup.sqlite"];
return YES;
}
-(void)checkAndCreateDatabase:(NSString *)name{
/*----Get the path to the Database----*/
NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDir = [documentPaths objectAtIndex:0];
NSString *databasePath = [documentsDir stringByAppendingPathComponent:name];
BOOL success;
NSFileManager *fileManager = [NSFileManager defaultManager];
success = [fileManager fileExistsAtPath:databasePath];
if(success){
NSLog(@"Database already exists");
return;
}
else{
NSLog(@"Database does not exist");
NSString *databasePathFromApp = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:name];
bool test = [fileManager fileExistsAtPath:databasePathFromApp];
if(test){ …Run Code Online (Sandbox Code Playgroud) 我有一个在xml中定义的进度条(swirly waiting style):
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@android:style/Widget.Holo.ProgressBar.Large"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:id="@+id/progress"
/>
Run Code Online (Sandbox Code Playgroud)
我隐藏它在活动onCreate方法中的可见性,使用,
progressBar.setVisibility(View.GONE);
Run Code Online (Sandbox Code Playgroud)
并onClick使用按钮的事件启动它
progressBar.setVisibility(View.VISIBLE);
Run Code Online (Sandbox Code Playgroud)
现在,如果我更改屏幕,则进度条会消失.我知道活动在方向更改时被销毁并重新创建,活动的状态将在保存的新方向中重新创建Bundle savedInstanceState.所以我认为Bundleandroid保存的默认值不包括对ProgressBarView对象所做的任何更改吗?
如果是这种情况,是否正确地说,在ProgressBar方向改变之后恢复正确可见性的唯一方法是boolean pbState = false/true通过覆盖方法onSaveInstanceState并检查此标志onRestoreInstanceState并相应地设置可见性来保存标志(例如)?或者,我遗漏了一些关于保存视图对象状态的明显信息.
谢谢
以下提供的解决方案都有效.我决定选择放入android:configChanges="orientation|screenSize"清单xml文件.但是,文档声明此方法应仅用作最后的手段.我的活动相当简单,因此清单xml方法减少了主活动所需的代码量,即没有onRestoreInstanceState方法.我认为如果你的活动更复杂,你可能想要使用后一种方法明确定义任何状态变化.
所以我在调试本地安装的gem:
/Users/myUser/.rvm/gems/ruby-1.9.3-p484@12wbt-engine/gems/locomotive_liquid-2.4.2
Run Code Online (Sandbox Code Playgroud)
现在我删除了这个文件夹.因此,我想知道是否有任何方法可以恢复它?
不工作:
bundle install
bundle update
Run Code Online (Sandbox Code Playgroud) 我这次使用的是Serializable Interface.我想将ArrayList从一个活动传递到另一个活动,但它给了我这个错误"无法编组值",代码是,
//发送活动:
public class LogIn extends Activity implements OnClickListener
{
ProgressDialog pd;
ImageButton logIn,registr;
EditText userName,Password;
public static String usrName,passwrd;
String TAG=LogIn.class.getName();
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.login);
userName=(EditText)findViewById(R.id.logIn_etuserName);
Password=(EditText)findViewById(R.id.logIn_etpaswrd);
logIn=(ImageButton)findViewById(R.id.logIn_B_logIn);
registr=(ImageButton)findViewById(R.id.logIn_B_registration);
logIn.setOnClickListener(this);
registr.setOnClickListener(this);
}
@Override
public void onClick(View v)
{
String respns="";
switch (v.getId())
{
case R.id.logIn_B_logIn:
try
{
usrName=userName.getText().toString();
passwrd=Password.getText().toString();
if(usrName.contentEquals("") && passwrd.contentEquals(""))
{
Toast.makeText(getApplicationContext(), "Enter userName",Toast.LENGTH_LONG).show();
}
// else if(passwrd.contentEquals(""))
// {
// Toast.makeText(getApplicationContext(), "Enter password",Toast.LENGTH_LONG).show();
// }
else
{
pd=ProgressDialog.show(LogIn.this, "LogIn", "Logging");
new …Run Code Online (Sandbox Code Playgroud) 我正在尝试遵循有关Shopify Apps的教程。首先,我尝试:
捆绑安装
但这给了我这个错误
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /tmp/bundler20171024-12759-18v2l7apg-0.21.0/gems/pg-0.21.0/ext
/usr/bin/ruby2.3 -r ./siteconf20171024-12759-2yizk4.rb extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for
building a client-side application.
You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for
building a client-side application.
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create …Run Code Online (Sandbox Code Playgroud) bundle ×10
android ×3
gem ×3
ruby ×3
carrierwave ×1
iphone ×1
login ×1
manifest ×1
objective-c ×1
rubygems ×1
serializable ×1
shopify ×1
symfony ×1
ubuntu ×1
xcode ×1