小编use*_*413的帖子

Android Whatsapp /聊天示例

有没有人有像WhatsApp这样的Android应用程序的示例教程?我想了解WhatsApp如何工作以及如何编程.

我想看一个使用带有"online"-status"read the message"-information 的消息聊天系统的例子.

我用谷歌但我一无所获.也许有人有小费.

谢谢.

android chat instant-messaging whatsapp

106
推荐指数
2
解决办法
20万
查看次数

权限被拒绝(缺少INTERNET权限?):但是获得了许可

我正在尝试调用httpClient,响应是"Permission denied(缺少INTERNET权限?)".在Android的普通浏览器中,我可以毫无问题地打开URL.

 public static String getHttpResponse(URI uri) {
    StringBuilder response = new StringBuilder();
    try {

        HttpGet get = new HttpGet();
        get.setURI(uri);
        DefaultHttpClient httpClient = new DefaultHttpClient();
        HttpResponse httpResponse = httpClient.execute(get);

        if (httpResponse.getStatusLine().getStatusCode() == 200) {
            Log.d("demo", "HTTP Get succeeded");

            HttpEntity messageEntity = httpResponse.getEntity();
            InputStream is = messageEntity.getContent();
            BufferedReader br = new BufferedReader(new InputStreamReader(is));
            String line;
            while ((line = br.readLine()) != null) {
                response.append(line);
            }
        }
    } catch (Exception e) {
        Log.e("demo", e.getMessage());
    }
    Log.d("demo", "Done with HTTP getting");
    return response.toString(); …
Run Code Online (Sandbox Code Playgroud)

android android-permissions

18
推荐指数
2
解决办法
6万
查看次数

方法getResources()和上下文未定义类型

我使用它getString()从string.xml成为String.在我的班级(非活动)不起作用:

  • context.getResources().的getString()
  • getResources().的getString()
  • context.getResources().的getString()

如何获取此类的String?

public class myClass{
     public String[] myInfo(String ID) {
        String myString = getRessources().getString(R.string.myString);
     };
}
Run Code Online (Sandbox Code Playgroud)

android getstring android-context

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

Android Java - 创建Cronjob

我想制作一个在后端工作的"Cronjob"并开始所有30分钟的方法.如果函数返回true(或其他内容),则"Cronjob"会创建状态栏通知.

这可能在Android?什么时候,哪个功能?

非常感谢你.

java cron android

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

悬停时从底部到顶部更改背景

如何a:hover使用从底部到顶部的过渡来更改背景颜色,持续时间为0.3秒?

<ul>
  <li><a></a></li>
  <li><a></a></li>
  <li><a></a></li>
</ul>
Run Code Online (Sandbox Code Playgroud)

那可能吗?

谢谢

background css3 css-transitions

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

Java - 按时间排序数组

第一:我使用数组来获取这样的信息:

// Tuesday
array[2][1] = "tuesday";
array[2][2] = "20:00";

// Wednesday 
array[3][1] = "Wednesday";
array[3][2] = "15:00";

// Thursday 
array[4][1] = "Thursday";
array[4][2] = "20:00";

// Friday
array[5][1] = "Friday";
array[5][2] = "18:00";

// Saturday
array[6][1] = "Saturday";
array[6][2] = "15:00";

// Sunday
array[7][1] = "Sunday";
array[7][2] = "15:00";
Run Code Online (Sandbox Code Playgroud)

如何按实际时间和工作日对数组进行排序?示例:现在是星期三 - 11:13.第一个Array-Item将是数组[3],然后是4,5,6,7,然后是2.

非常感谢你.

java sorting datetime

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

滚动时Android ListView生涩

我正在使用XMLParser为Listview获取带有Date的XML.解析器将日期发送到LazyAdapter,并将LazyAdapter发送到列表.

当我在我的应用程序中滚动时,ListView是生涩而缓慢的.我认为问题将是ImageLoader.当我使用ImageLoader禁用该行时,它的工作更好而不生涩.

LazyAdapter:

  public View getView(int position, View convertView, ViewGroup parent) {
        View vi=convertView;
        if(convertView==null)


        vi = inflater.inflate(R.layout.list_row, null);

        TextView id = (TextView)vi.findViewById(R.id.id); 
        TextView title = (TextView)vi.findViewById(R.id.title);
        TextView artist = (TextView)vi.findViewById(R.id.artist);
        ImageView thumb_image=(ImageView)vi.findViewById(R.id.list_image); 

        HashMap<String, String> coupon = new HashMap<String, String>();
        coupon = data.get(position);

        id.setText(coupon.get(NewCoupons.id));
        title.setText(title);
        artist.setText(coupon.get(NewCoupons.artist));
        imageLoader.DisplayImage(KEY_THUMN, thumb_image);
        return vi;
    }
Run Code Online (Sandbox Code Playgroud)

ImageLoader:

public class ImageLoader {

    MemoryCache memoryCache=new MemoryCache();
    FileCache fileCache;
    private Map<ImageView, String> imageViews=Collections.synchronizedMap(new WeakHashMap<ImageView, String>());
    ExecutorService executorService; 

    public ImageLoader(Context context){
        fileCache=new FileCache(context);
        executorService=Executors.newFixedThreadPool(5);
    }

    final int stub_id = …
Run Code Online (Sandbox Code Playgroud)

android android-layout android-listview

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