小编Mah*_*ahe的帖子

Android Google地图:禁用MapFragment中的拖动功能

当用户尝试用手指拖动地图而不打扰放大和缩小时,我可以禁用拖动功能吗?

任何人请建议这样做的想法!感谢您的宝贵帮助!!

android google-maps drag mapfragment

56
推荐指数
5
解决办法
3万
查看次数

将ArrayList添加到java中的另一个ArrayList

我有以下java代码,我试图将ArrayList复制到另一个ArrayList.

 ArrayList<String> nodes = new ArrayList<String>();
 ArrayList NodeList=new ArrayList();
 ArrayList list=new ArrayList();

        for(int i=0;i<PropertyNode.getLength()-1;i++){
            Node childNode =  PropertyNode.item(i);
                NodeList Children = childNode.getChildNodes();

                if(Children!=null){
                    nodes.clear();
                    nodes.add("PropertyStart");
                    nodes.add(Children.item(3).getTextContent());
                    nodes.add(Children.item(7).getTextContent());
                    nodes.add(Children.item(9).getTextContent());
                    nodes.add(Children.item(11).getTextContent());
                    nodes.add(Children.item(13).getTextContent());
                    nodes.add("PropertyEnd");

                }   
                NodeList.addAll(nodes);
                list.add(NodeList);
        }
Run Code Online (Sandbox Code Playgroud)

我希望"list"数组采用以下格式:

[[PropertyStart,a,b,c,PropertyEnd],[PropertyStart,d,e,f,PropertyEnd],[PropertyStart,......]]
Run Code Online (Sandbox Code Playgroud)

但是从上面的代码中,"list"数组输出如下所示:

[PropertyStart,a,b,c,PropertyEnd,PropertyStart,d,e,f,PropertyEnd,PropertyStart,....PropertyEnd]
Run Code Online (Sandbox Code Playgroud)

我想你可能已经注意到了这种差异.我无法达到预期格式的结果.请建议我任何解决方案!提前致谢!!

java arraylist

29
推荐指数
2
解决办法
14万
查看次数

替换字符串中字符的上次出现次数

我有这样的字符串

"Position, fix, dial"
Run Code Online (Sandbox Code Playgroud)

我想用转义双引号(\")替换最后一个双引号(")

字符串的结果是

"Position, fix, dial\"
Run Code Online (Sandbox Code Playgroud)

我怎样才能做到这一点.我知道替换第一次出现的字符串.但不知道如何替换最后一次出现的字符串

java string replace last-occurrence

22
推荐指数
2
解决办法
7万
查看次数

错误:"无法在设备'模拟器-5554上安装apk':超时"

我使用模拟器运行我的应用程序.花了这么长时间上传大约5分钟,在我的模拟器上安装我的应用程序需要2分钟.两分钟后它失败了.

这是错误控制台,

[2013-03-28 14:13:18 - newwaterreadingapp] ------------------------------
[2013-03-28 14:13:18 - newwaterreadingapp] Android Launch!
[2013-03-28 14:13:18 - newwaterreadingapp] adb is running normally.
[2013-03-28 14:13:18 - newwaterreadingapp] Performing     
com.example.newwaterreadingapp.MainActivity activity launch
[2013-03-28 14:13:18 - newwaterreadingapp] Automatic Target Mode: using existing     emulator 'emulator-5556' running compatible AVD 'NewAvd_water_electricity_reading'
[2013-03-28 14:13:18 - newwaterreadingapp] Uploading newwaterreadingapp.apk onto device 'emulator-5556'
[2013-03-28 14:18:31 - newwaterreadingapp] Installing newwaterreadingapp.apk...
[2013-03-28 14:20:35 - newwaterreadingapp] Failed to install newwaterreadingapp.apk on   device 'emulator-5556!
[2013-03-28 14:20:35 - newwaterreadingapp] (null)
[2013-03-28 14:20:37 - newwaterreadingapp] Launch …
Run Code Online (Sandbox Code Playgroud)

android install emulation apk

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

java.lang.NoClassDefFoundError:com.google.android.gms.R $在android中的样式

我尝试了在android中显示谷歌地图v2的演示.

java代码是,

package com.example.gpslocator;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
}


@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}    
}
Run Code Online (Sandbox Code Playgroud)

Xml代码是,

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>

<fragment 
      android:id="@+id/map"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:name="com.google.android.gms.maps.MapFragment"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

我在manifest.xml中添加了API密钥,

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.gpslocator"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="3"
    android:targetSdkVersion="17" />

<uses-permission …
Run Code Online (Sandbox Code Playgroud)

maps android

13
推荐指数
2
解决办法
5万
查看次数

OnItemClickListener和OnClickListener不适用于ListView

我使用了自定义ListView,我使用相同的ListView显示一些数据.

当我单击列表视图项时,不会调用onClickListener.我无法选择任何列表项.

布局代码:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginBottom="16dp"
android:background="@drawable/list_selector"
android:clickable="true"
android:orientation="horizontal"
android:padding="5dip" >

<LinearLayout
    android:id="@+id/imgProperty"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_marginRight="5dip"
    android:padding="3dip" >

    <ImageView
        android:id="@+id/list_image"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:contentDescription="@string/app_name"
        android:src="@drawable/ic_launcher" 
        android:focusable="false"/>
</LinearLayout>

<TextView
    android:id="@+id/tvCity"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerVertical="true"
    android:layout_marginLeft="75dip"
    android:layout_toRightOf="@+id/list_image"
    android:paddingBottom="10dip"
    android:text="property"
    android:textColor="#040404"
    android:textSize="15sp"
    android:textStyle="bold"
    android:typeface="sans" />

<TextView
    android:id="@+id/tvprice"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBottom="@+id/imgProperty"
    android:layout_alignLeft="@+id/tvCity"
    android:text="Price" 
    android:focusable="false"/>

</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

适配器代码:

 public class CustomListAdapter extends BaseAdapter {

 ArrayList<Propety> PropertiesArray;
private LayoutInflater Inflater;


public CustomListAdapter(ArrayList<Propety> PropertiesArray) {  

   this.PropertiesArray=PropertiesArray;

}
@Override
public int …
Run Code Online (Sandbox Code Playgroud)

android listview scroll onitemclicklistener onclicklistener

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

Org.json.JSONException:字符1834处的未终止字符串

我从webservice获取数据,我正在解析为JSON字符串.在解析时我是这个例外:"org.json.JSONException:字符1834处的未终止字符串"

我的代码是,

String jsonstring=getJSONString(response);

JSONObject json = new JSONObject(jsonstring);
Run Code Online (Sandbox Code Playgroud)

字符串是,

[{"LotDescription":"David Weekley homes Traditional Collection in Baxter Village offers floor plans featuring innovative design and unsurpassed quality. This charming community combines work, play and living, all within the Village. In Baxter Village, you&rsquo;ll enjoy:&nbsp; Parks, playgrounds"}]
Run Code Online (Sandbox Code Playgroud)

它正在解析直到单词"Village"并在解析"you"时提出异常,这似乎是一些HTML内容.

这是什么解决方案?

java android json

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

关闭设备后,Android SQLite数据库是否仍然存在?

我想开发一款Android应用.我想从用户那里获得输入并将其存储在手机的数据库中.

即使手机关机,我的数据也应保留在手机中.这可能使用SQLite数据库吗?

sqlite android

5
推荐指数
1
解决办法
5427
查看次数

如何在android apk文件中保护webservice url

我已经构建了一个Android应用程序,它从我提到的网址" http://www.google.com/getData "中获取来自网络服务的数据

如果有人解密我的apk文件,webservice url将变得可见,并且有可能误用它或者可以使用我的数据甚至自定义它.我使用Android内置的HTTP POST来调用Web服务和获取数据.

我希望我的webservice网址免受窥探者,黑客等的影响.请建议我可以使用哪种机制来保护我的网络服务网址.这对我来说是个问题.我是android的初学者.请帮忙!

任何建议或帮助表示赞赏!谢谢!!

security post android web-services http

5
推荐指数
1
解决办法
4129
查看次数

如何知道asp.net网站是从移动设备还是从系统/笔记本电脑/机器(windows,mac等)访问

我使用asp.net web developer 2010开发了一个网站.如果从移动浏览器访问该网站,我想重定向到不同的页面.并且,windows/mac/linux等用户的不同功能.

我怎样才能做到这一点?

我在一些论坛中提到了一些帖子,据说我需要依赖第三方库.

如果没有任何第三方库,我怎么能实现这个?

任何人请帮助我.

任何帮助表示赞赏.谢谢!!

c# browser asp.net iphone mobile-browser

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