我不知道如何将时间戳转换为日期.我有:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView czas = (TextView)findViewById(R.id.textView1);
String S = "1350574775";
czas.setText(getDate(S));
}
private String getDate(String timeStampStr){
try{
DateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
Date netDate = (new Date(Long.parseLong(timeStampStr)));
return sdf.format(netDate);
} catch (Exception ignored) {
return "xx";
}
}
Run Code Online (Sandbox Code Playgroud)
答案是:1970年1月16日,但是错了.
我需要注册新设备,因为我需要mobileprovision.我不能使用mobileprovision因为UDID已经FFFFFFFF开始了.我认为这是错误的UDID.
知道怎么解决吗?
我有一个带有GridLayoutManager的RecyclerView.
我设置了一个自定义ItemDecoration:
public class ListDetailsItemDecoration extends RecyclerView.ItemDecoration {
private int space;
public ListDetailsItemDecoration(int space) {
this.space = space;
}
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
int itemPosition = parent.getChildPosition(view);
outRect.left = space;
outRect.right = space;
outRect.bottom = space;
if(itemPosition == 0 || itemPosition == 1) {
outRect.top = space;
}
if(itemPosition % 2 == 0) {
outRect.right = space / 2;
} else {
outRect.left = space / 2;
}
}
}
Run Code Online (Sandbox Code Playgroud)
它工作得很好,直到我需要删除任何人.
notifyItemRemoved(position); …Run Code Online (Sandbox Code Playgroud) 我有内置WebView的NestedScrollView,我正在使用折叠工具栏.
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="fill_vertical"
>
<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</android.support.v4.widget.NestedScrollView>
Run Code Online (Sandbox Code Playgroud)
当我加载webView的内容并且内容比屏幕更高时,它的效果很好.工具栏在滚动时隐藏/显示.
第二种情况是webview的内容很小.当我挂NestedScrollView在底部并向上拖动时,工具栏隐藏并拖动到显示的底部工具栏.
当我尝试拖动WebView它不起作用时,视图仍然在同一个地方.
知道如何解决这个问题.
当内容WebView太小或禁用滚动时,不允许隐藏工具栏WebView
我的问题是行mysql_query.我需要:
Record 0: 2,text is text,3.23
Run Code Online (Sandbox Code Playgroud)
但是我有:
Record 0: 2
Record 1: text
Record 2: is
Record 3: text
Record 4: 3.23
Run Code Online (Sandbox Code Playgroud)
请帮我.
results=($(mysql --user root -proot test -Bse "select id,name from Object"));
cnt=${#results[@]}
for (( i=0 ; i<${cnt} ; i++ ))
do
echo "Record No. $i: ${results[$i]}"
fieldA=${results[0]};
fieldB=${results[1]};
done
Run Code Online (Sandbox Code Playgroud) 我正在努力CollapsingToolbarLayout.我不知道在工具栏中固定标题的方法.
有没有简单的方法来实现这一目标?
当ft.commit()出现异常时,我不知道为什么。
java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1448)
at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1466)
at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:634)
at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:613)
at MainActivity.attachFragment(MainActivity.java:242)
at MainActivity.attachFragment(MainActivity.java:225)
at MainActivity.showHome(MainActivity.java:171)
at MainActivity.onComplete(MainActivity.java:278)
at MDownloadManager.onDownloadComplete(MDownloadManager.java:83)
at DownloadRequestQueue$CallBackDelivery$2.run(DownloadRequestQueue.java:61)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:149)
at android.app.ActivityThread.main(ActivityThread.java:5257)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
at dalvik.system.NativeStart.main(NativeStart.java)
Run Code Online (Sandbox Code Playgroud)
这是崩溃即将来临的我的方法。
FragmentManager fm = getSupportFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
if(addToBackStack) {
ft.addToBackStack(null);
ft.add(R.id.frame_container, fragment, tag);
} else {
ft.replace(R.id.frame_container, fragment, tag);
}
ft.commit();
Run Code Online (Sandbox Code Playgroud)
你知道什么地方出了问题吗?我不在项目中使用onSaveInstanceState。
我有检测qr代码在哪里的问题.
我需要在它周围画边框.
我使用AVMetadataObject bezierpath,但它不起作用.
请帮我.
- (void)captureOutput:(AVCaptureOutput *)captureOutput
didOutputMetadataObjects:(NSArray *)metadataObjects
fromConnection:(AVCaptureConnection *)connection
{
for (AVMetadataObject *metadata in metadataObjects)
{
AnimationView *cv = [[AnimationView alloc]initWithFrame:self.livevideo.bounds]; //creat an instance of your custom view
[cv setBackgroundColor:[UIColor clearColor]];
NSLog(@"%f",metadata.accessibilityPath.accessibilityActivationPoint.x);
[location addSubview:cv];
if ([metadata.type isEqualToString:AVMetadataObjectTypeEAN13Code])
{
}
else if ([metadata.type isEqualToString:AVMetadataObjectTypeUPCECode])
{
}
else if ([metadata.type isEqualToString:AVMetadataObjectTypeEAN8Code])
{
}
else if ([metadata.type isEqualToString:AVMetadataObjectTypeQRCode])
{
}
}
}
Run Code Online (Sandbox Code Playgroud) 我有值的路径,我想制作这个渐变.
这是代码:
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetStrokeColorWithColor(context, [[UIColor colorWithRed:245.0/255.0 green:245.0/255.0 blue:171.0/255.0 alpha:0.6] CGColor]);
CGContextSetFillColorWithColor(context, [[UIColor colorWithRed:245.0/255.0 green:245.0/255.0 blue:171.0/255.0 alpha:0.6] CGColor]);
UIBezierPath *aPath = [UIBezierPath bezierPath];
[aPath moveToPoint:CGPointMake(30.0, 100.0)];
[aPath addLineToPoint:CGPointMake(200.0, 120.0)];
[aPath addLineToPoint:CGPointMake(300, 210)];
[aPath addLineToPoint:CGPointMake(300, 420)];
[aPath addLineToPoint:CGPointMake(30, 420.0)];
[aPath addLineToPoint:CGPointMake(30, 100.0)];
[aPath closePath];
[aPath fill];
Run Code Online (Sandbox Code Playgroud)
有没有指出这个代码的问题?
我已附加按钮以查看此框架:
主视图外部的按钮部分不可单击...
有解决方案吗?