小编Mys*_*icϡ的帖子

连接到sonatype nexus时如何传递凭据(禁用匿名登录)?

在eclipse中,m2eclipse插件会在我构建maven2项目时提示我输入凭据.它编译得很好.

但是,如果我现在尝试从命令行运行"mvn install",我会收到一个找不到工件的错误.如何将用户名/密码添加到我的pom.xml中以解决此问题.

java command-line maven-2 nexus sonatype

4
推荐指数
1
解决办法
8013
查看次数

如何在android中以表格格式显示数据?

我是android的新手.现在我正在研究一些数据库示例程序.现在我在以表格格式显示从数据库检索的数据时遇到问题.如果有人知道答案,请帮我提供源代码.

android

4
推荐指数
1
解决办法
1672
查看次数

Android ListView的理解

我有一个关于ListView的问题以及如何使用它.我的Prolem是我的listView只是视图的一部分,我不知道如何做到这一点.

public class MainActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    ListView myListView = (ListView) findViewById(R.id.ListView01);
    String[] strings = new String[]{"Test1","Test2"};
    ArrayAdapter<String> myArrayAdapter= new ArrayAdapter<String>(this, R.id.ListView01,strings);
    myListView.setAdapter(myArrayAdapter);
Run Code Online (Sandbox Code Playgroud)

我认为问题是myArrayAdapter中的"this"!

android android-listview

4
推荐指数
1
解决办法
1684
查看次数

SAX,StringBuilder和内存泄漏

我有一个奇怪的问题.我正在解析一个包含大文本字段的文档.在我的角色部分,我正在使用StringBuilder

currentStory.append(ch, start, length);
Run Code Online (Sandbox Code Playgroud)

然后在我的endElement中我将它分配给我对象上的相应字段.

  if (name.equals(tagDesc)) {
     inDesc = false;
     if (currentItem != null ) {
         currentItem.setSummaryText(currentStory.toString());
     }
     currentStory.setLength(0);
  }
Run Code Online (Sandbox Code Playgroud)

setSummaryText(String text) 方法是:

    public void setSummaryText(String text) {
      Story = text;
    }
Run Code Online (Sandbox Code Playgroud)

而且我的内存耗尽了.

如果我将setSummaryText改为像这样完全奇怪的东西

public void setSummaryText(String text) {
      char[] local = text.toString()
      Story = new String(local);
   }
Run Code Online (Sandbox Code Playgroud)

我很好.我只是无法弄清楚我拿着那个参考?Story是用""初始化的对象的成员var; 注 - 分配给本地String变量而不是char [] - 也会失败.

android memory-leaks sax

4
推荐指数
1
解决办法
1855
查看次数

我试图通过点击它将图像按钮旋转到360但它不能旋转它?

我试图通过单击自己将图像按钮旋转到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 …

android rotation

4
推荐指数
1
解决办法
5893
查看次数

如何在webview中为手机和平板电脑提供两个链接?

我有两个链接,例如:说facebook.com和m.facebook.com.如果是Android手机,我想

打开m.facebook.com.如果是Android平板电脑,我想打开facebook.com链接.我想做的

webview.怎么可能?

android android-widget android-intent android-layout

4
推荐指数
1
解决办法
280
查看次数

为什么android:layout_gravity ="right"在android xml中不起作用

我的列表视图行的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

4
推荐指数
2
解决办法
3万
查看次数

跟踪移动服务提供商名称

我被分配了一个访问移动服务提供商名称而不是位置的任务.我搜索并提到了很多东西.但我找不到.显示所有位置(即纬度和经度值),其中一些显示网络提供商名称.我需要像Cell Info Display Name这样的东西.

Example: If I'm using Vodafone Network it will display the service provider name that my mobile is currently using.
Run Code Online (Sandbox Code Playgroud)

我不需要在地图中显示位置和位置.我只需要显示服务提供商名称.有什么方法吗?有谁可以通过示例代码解释?

android service-provider

4
推荐指数
1
解决办法
5548
查看次数

使用Android中的服务中的SQLite数据库

我想知道以下是否可行.我希望有一个活动和服务都对数据库进行更改,一旦活动停止运行,服务是否仍然能够访问和更改数据库的内容?

我知道服务一旦关闭就可以独立于活动运行,但是不确定数据库访问是否仍然可以继续?

sqlite android android-service

4
推荐指数
2
解决办法
1万
查看次数

如何将数据设置为片段(setArgumets()vs setters方法)

是否必须使用bundle和set参数设置数据?这有什么不对?

MyFragment frag = new MyFragment ()
frag.setData(mSchoolData);

//add to back stack stuff.
Run Code Online (Sandbox Code Playgroud)

android android-fragments

4
推荐指数
1
解决办法
961
查看次数