小编Ste*_*oen的帖子

如何在Google的DeskClock应用中设置闹钟的时间?

可以访问Root.基本上我需要一种方法来阅读内容://settings/system/alarm_alert从应用程序中获取警报的时间(或剩余时间).

我找到了旧项目android-alarm-database,但这只适用于较旧的闹钟应用程序.

android clock alarm

3
推荐指数
1
解决办法
1690
查看次数

在Gingerbread及其下方是否有/兼容库使用NotificationBuilder?

我喜欢NotificationBuilder的易用性,需要经常更新我的通知.有没有办法在早期版本的Android上使用这个梦幻般的课程?

notifications android

3
推荐指数
1
解决办法
1003
查看次数

Dart2js生成大型javascript文件,即使代码很少?

我是dart的新手,在Windows上使用Dart编辑器.

我注意到我编译的javascript很大,所以我不断删除越来越多的代码来查看导致它的原因,但我认为我无处可去.这是我的程序:

import 'dart:html';

void main() {
  var video = querySelector("#vid");
}
Run Code Online (Sandbox Code Playgroud)

这就是字面意思.除了一条指令,我已经删除了所有内容.

这是生成的javascript(它不适合内联):

https://gist.github.com/DSteve595/504887a19a05614bcc94

我究竟做错了什么?这个程序几乎是空的!

javascript dart dart-editor

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

在以3.0+为目标时,在runnable中获取NetworkOnMainThreadException

由于ActionBarSherlock的问题,我将我的Manifest更改为目标API 16,从那时起我检查当前正在播放的歌曲的处理程序不再有效.它在我下面标记的行上抛出NetworkOnMainThreadException.

我究竟做错了什么?我以为我的多线程设置正确.

这是我的代码:

    handler = new Handler();

    updateSongTask = new Runnable() {
        public void run() {
            Log.d("asdf", "scraper started");
            Scraper scraper = new ShoutCastScraper(); // THIS LINE throws the exception
            List<Stream> streams;
            try {
                streams = scraper.scrape(new URI(url));
                for (Stream stream : streams) {                     
                    Intent songIntent = new Intent(CUSTOM_INTENT);

                    String[] songAndArtist = songAndArtist(stream.getCurrentSong());
                    songIntent.putExtra("song", songAndArtist[0]);
                    songIntent.putExtra("artist", songAndArtist[1]);
                    songIntent.putExtra("stationurl", url);
                    sendBroadcast(songIntent);
                    Log.d("asdf", "should send broadcast" );

                }
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

            handler.postDelayed(this, …
Run Code Online (Sandbox Code Playgroud)

multithreading android asynchronous handler networkonmainthread

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

来自Asynctask的JSON和网络操作?

我在网上找到了一个优秀的JSON解析器,我想在我的项目中使用它.会有很多JSON请求,所以我希望能够重用代码.这是JSON解析器:

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.json.JSONException;
import org.json.JSONObject;

import android.util.Log;

public class JSONParser {

    static InputStream is = null;
    static JSONObject jObj = null;
    static String json = "";

    // constructor
    public JSONParser() {

    }

    public JSONObject getJSONFromUrl(String url) { 
        // Making HTTP request
        try {
            // defaultHttpClient
            DefaultHttpClient httpClient = new DefaultHttpClient();
            HttpPost httpPost = new HttpPost(url);

            HttpResponse httpResponse = httpClient.execute(httpPost);
            HttpEntity …
Run Code Online (Sandbox Code Playgroud)

android json asynchronous

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