我有什么: 目前我的应用程序通过GPS提供位置.
我想要的是: Gps在我退出应用程序后自动关闭.因为它一直在告诉我一次又一次的位置看起来很奇怪而且gps消耗了很多电池.
我想在屏幕上拖动图像.
我怎样才能做到这一点?
在我的例子中,图像只是从URL下载并放在一个活动上.
我只是想拖动它.
提前致谢!!
我已经在我的项目中集成了AdWhirl,我现在只想显示Admob.
但是只显示了一个广告...没有其他广告即将推出....在LogCat中,它是30秒后的刷新广告,但它们不会显示在屏幕上.
我使用与AdWhirl官方网站相同的编码.
请告诉我如何做到这一点......我非常迫切需要它.
<LinearLayout
android:id="@+id/layout_main"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="" />
<com.adwhirl.AdWhirlLayout
android:id="@+id/adwhirl_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
这是我的主要课程:
try
{
AdWhirlManager.setConfigExpireTimeout(1000 * 60 * 5);
AdWhirlTargeting.setAge(23);
// AdWhirlTargeting.setGender(AdWhirlTargeting.Gender.MALE);
// AdWhirlTargeting.setKeywords("online games gaming");
// AdWhirlTargeting.setPostalCode("94123");
AdWhirlTargeting.setTestMode(false);
AdWhirlLayout adWhirlLayout = (AdWhirlLayout) findViewById(R.id.adwhirl_layout);
// TextView textView = new TextView(this);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
int diWidth = 320;
int diHeight = 52;
int density = (int) getResources().getDisplayMetrics().density;
adWhirlLayout.setAdWhirlInterface(this);
adWhirlLayout.setMaxWidth((int) (diWidth * density));
adWhirlLayout.setMaxHeight((int) (diHeight * density));
layoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL); …Run Code Online (Sandbox Code Playgroud) 我需要调用"HTTPS"api并将JSON params传递给服务器.
现在我想这样:
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("https://myapi call goes here...");
httppost.setHeader("Content-Type", "application/json");
try
{
JSONObject j = new JSONObject();
j.put("email", "my email value goes here");
StringEntity s = new StringEntity(j.toString());
httppost.setEntity(s);
HttpResponse response = httpclient.execute(httppost);
/* Checking response */
if(response != null)
{
responseBody = EntityUtils.toString(response.getEntity());
}
if(responseBody.equals("ok"))
{
}
}
catch (final Exception e)
{
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
但它给了我例外:SSL Peer未经验证:没有同行证书.
请注意,我必须只使用HTTPS来拨打api.
有人有什么想法?
我做了什么:我已经制作了一个自定义启动器,实际上在加载时运行/设置为主屏幕启动器.它也出现在已安装的启动器列表中,这意味着到目前为止一切都很好.
我想要的是:但是,当我启动/设置我的应用程序作为启动器并按下后退按钮时,它将转到先前设置的启动器屏幕.
我猜不应该这样.它应保持设置为设备的主/默认启动器.
我的代码添加:
在我的清单中,我添加了以下内容:
<activity
android:name=".Main"
android:launchMode="singleTask"
android:clearTaskOnLaunch="true"
android:stateNotNeeded="true"
android:theme="@android:style/Theme.Wallpaper.NoTitleBar.Fullscreen"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<!-- These two lines are setting it as a launcher-->
<category android:name="android.intent.category.HOME"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)
知道如何实现我的目标吗?
我有一个膨胀的线性布局,其中包含2个TextView.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:orientation="vertical" >
<TextView
android:id="@+id/tv_m"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ll_borders"
android:tag="m"
android:text="m" />
<TextView
android:id="@+id/tv_q"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ll_borders"
android:tag="q"
android:text="q" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
我想要的是,当这个线性布局膨胀时,我想得到TEXTVIEW我点击的唯一.例如,如果我点击" tv_m",那么它只会返回我的文本tv_m.
可能它很简单,但我没有办法解决它.所以我需要帮助.
谢谢
我想获取Skype数据库文件,该文件名为main.db,并且不像WhatsApp等那样加密,并将该文件复制到我的自定义文件夹中.
我想要做的是以下内容:( 我的设备已植根,我正在给我的应用程序SuperUser访问权限)
public void getSkypeDB() throws InterruptedException
{
Process sh;
try
{
sh = Runtime.getRuntime().exec("su", null, null);
File skypeDir= new File("/data/app", "/com.skype.raider");
Toast.makeText(getApplicationContext(), skypeDir.toString(), 0).show();
sh.waitFor();
}
catch (IOException e)
{
e.printStackTrace();
}
}
Run Code Online (Sandbox Code Playgroud)
这样做之后,我的应用程序崩溃了!
如何访问其数据库或访问/data/app文件夹中数据库的位置?