有没有人有像WhatsApp这样的Android应用程序的示例或教程?我想了解WhatsApp如何工作以及如何编程.
我想看一个使用带有"online"-status
和"read the message"
-information 的消息聊天系统的例子.
我用谷歌但我一无所获.也许有人有小费.
谢谢.
我正在尝试调用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) 我使用它getString()
从string.xml成为String.在我的班级(非活动)不起作用:
如何获取此类的String?
public class myClass{
public String[] myInfo(String ID) {
String myString = getRessources().getString(R.string.myString);
};
}
Run Code Online (Sandbox Code Playgroud) 我想制作一个在后端工作的"Cronjob"并开始所有30分钟的方法.如果函数返回true(或其他内容),则"Cronjob"会创建状态栏通知.
这可能在Android?什么时候,哪个功能?
非常感谢你.
如何a:hover
使用从底部到顶部的过渡来更改背景颜色,持续时间为0.3秒?
<ul>
<li><a></a></li>
<li><a></a></li>
<li><a></a></li>
</ul>
Run Code Online (Sandbox Code Playgroud)
那可能吗?
谢谢
第一:我使用数组来获取这样的信息:
// 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.
非常感谢你.
我正在使用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)