Tag: android

如何在Android上以编程方式启用或禁用GPS?

我知道关于在an​​droid 上 以编程方式打开/closuresGPS的问题已经 讨论过 很多 次了 ,答案总是一样的: “你不能出于安全/隐私的原因,你必须转发到位置偏好屏幕,并让用户启用/禁用它。 据我所知,不过最近我从市场上购买了Tasker ,而且还可以用它来完成许多其他的事情,你可以设置规则来在进入预定的应用程序时自动启用GPS,并在退出时禁用它(参见这里教程如何做到这一点,它只是工作!),这个应用程序不能用固件签名密钥签名,因为它适用于许多Android版本和不同的设备,你甚至不需要根植。 我想在我的应用程序中做到这一点。 当然,我不想炸掉用户的隐私,所以我首先会询问用户是否想用典型的“记住我的决定”checkbox自动打开它,如果他回答是,启用它。 有没有人有任何想法或线索塔斯克如何实现这一目标?

我怎样才能让我的自定义对象Parcelable?

我试图让我的对象Parcelable。 但是,我有自定义对象,这些对象有我做的其他自定义对象的ArrayList属性。 什么是最好的方法来做到这一点?

以编程方式获取Android手机的电话号码

我怎样才能以编程方式获取运行我的android应用程序的设备的电话号码?

有没有办法从APK文件中获取源代码?

笔记本电脑上的硬盘驱动器刚刚崩溃,我丢失了过去两个月来一直在使用的应用程序的所有源代码。 我所拥有的是从我发送给朋友的邮件中存储的APK文件。 有没有什么办法从这个APK文件中提取我的源代码?

Android“只有创build视图层次结构的原始线程才能触及其视图。”

我已经在Android中构build了一个简单的音乐播放器。 每首歌曲的视图都包含一个SeekBar,实现如下: public class Song extends Activity implements OnClickListener,Runnable { private SeekBar progress; private MediaPlayer mp; // … private ServiceConnection onService = new ServiceConnection() { public void onServiceConnected(ComponentName className, IBinder rawBinder) { appService = ((MPService.LocalBinder)rawBinder).getService(); // service that handles the MediaPlayer progress.setVisibility(SeekBar.VISIBLE); progress.setProgress(0); mp = appService.getMP(); appService.playSong(title); progress.setMax(mp.getDuration()); new Thread(Song.this).start(); } public void onServiceDisconnected(ComponentName classname) […]

如何在Android上调用SOAP Web服务

我很难find有关如何使用Android调用标准SOAP / WSDL Web服务的好信息。 我所能find的都是非常复杂的文档和对“kSoap2”的引用,然后一些关于SAX手动parsing的内容。 好吧,这很好,但是现在是2008年,所以我觉得应该有一个好的库来调用标准的Web服务。 Web服务基本上是在NetBeans中创build的。 我想要IDE支持生成pipe道类。 我只需要以最简单/最优雅的方式联系基于Android的手机的基于WSDL的Web服务。

如何获得安装的Android应用程序的列表,并select一个运行

我在本周早些时候提出了一个类似的问题,但我仍然不知道如何获得所有安装的应用程序的列表,然后select一个运行。 我试过了: Intent intent = new Intent(ACTION_MAIN); intent.addCategory(CATEGORY_LAUNCHER); 这只显示预安装的应用程序或者可以运行ACTION_MAIN意图types的应用程序。 我也知道我可以使用PackageManager来获取所有已安装的应用程序,但是如何使用它来运行特定的应用程序?

我如何在Android项目中使用外部JAR?

我创build了一个Android项目,并在我的项目中添加了一个外部JAR(hessian-4.0.1.jar)。 然后,我将JAR添加到构buildpath,并在“订单和导出”中将其检查。 看起来Order和Export被忽略,并且外部JAR中的所有类都在运行时丢失。 在使用Eclipse插件构buildAndroid应用程序时,是否有一种方法可以正确包含来自外部JAR的所需类? 我不想用ant或Maven。

Android ListView,每行有不同的布局

我正在试图确定有一个ListView包含每行不同的布局的最佳方法。 我知道如何创build一个自定义的行+自定义数组适配器来支持整个列表视图的自定义行,但我怎样才能在ListView中实现许多不同的行样式?

ScrollView里面的ListView不在Android上滚动

我在ScrollView里滚动ListView时遇到了麻烦。 我有一个活动,其中有一些EditTexts在顶部,然后一个标签主机与两个选项卡有一个ListView每个。 当EditText视图集中时,软键盘出现,因为我有一个滚动视图,内容是可滚动的。 但是,当ListView中有更多的项目(标签中的项目)时,问题就来了,即使有更多的项目,我也无法滚动ListView。 以下是XML的布局: <?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="fill_parent" android:background="?backgroundImage" android:orientation="vertical"> <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="50dip" android:layout_alignParentBottom="true" android:layout_margin="10dip" android:id="@+id/buttons"> <Button android:text="Save" android:layout_margin="2dip" android:textSize="20dip" android:id="@+id/btnSaveorUpdate" android:layout_height="wrap_content" android:layout_width="145dip"></Button> <Button android:text="Cancel" android:layout_margin="2dip" android:textSize="20dip" android:id="@+id/btnCancelorDelete" android:layout_height="wrap_content" android:layout_width="145dip"></Button> </LinearLayout> <ScrollView android:layout_above="@id/buttons" android:layout_width="fill_parent" android:layout_height="fill_parent" android:fillViewport="true" android:layout_margin="10dip"> <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_margin="10dip"> <TextView android:text="Bill details" android:textColor="?textColorDark" android:layout_alignParentTop="true" android:id="@+id/txtEnterDetails" android:textSize="25dip" android:textStyle="bold" […]