jump to navigation

[SOLVED]Paketdatei war nicht richtig signiert Ноябрь 23, 2009

Posted by russenreaktor in android.
add a comment

«NM I got it working I just had to

adb remount

adb shell rm /system/sd/app/*Maps*

adb shell rm /system/sd/app/*maps*

adb shell rm /system/sd/dalvik-cache/*Maps*

adb shell rm /system/sd/dalvik-cache/*maps*

adb shell rm /data/app/*Maps*

adb shell rm /data/app/*maps*

adb shell rm /data/dalvik-cache/*Maps*

adb shell rm /data/dalvik-cache/*maps*

adb shell rm /system/app/*Maps*

adb shell rm /system/app/*maps*

adb uninstall com.google.android.apps.maps

that let me uninstall and install the new maps.» forum.xda-developers.com

[SOLVED]Eclipse and .svn Android AIDL Problem Август 17, 2009

Posted by russenreaktor in android, develop, eclipse, programming.
Tags: ,
add a comment

Today after adding my android project to svn repository I got

syntax error    entries /src/.svn  line 1  Android AIDL Problem

After searching internet for solutions I installed subversion plug-in (did not helped) but this…

It is worked for me:

  • Delete your project from eclipse (not from disk).
  • «File»->»New..»->»Project»->»Android Project»
  • in «New Adroid Project»-Dialog selected «create project from existing source» (find your project on HDD)->»Finish»

my .classpath-file

<?xml version="1.0" encoding="UTF-8"?><classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="output" path="bin"/></classpath>

Android ImageLoader – load images sequencially in the background Август 11, 2009

Posted by russenreaktor in android.
add a comment

«A few days ago I started to learn android… and it’s been a fairly smooth transition from flash. Although I have to say, as flash developers we’re just spoiled. We take for granted all the background stuff flash does for us to make coding that much easier.

One of those things is Loading images. in flash we have the Loader class which makes loading images very easy.

var loader:Loader = new Loader();

loader.load(new URLRequest(«myimage.jpg»));

In java/android it takes a few more lines

HttpURLConnection conn = (HttpURLConnection) new URL(«myimage.jpg»).openConnection();

conn.setDoInput(true);

conn.connect();

InputStream inStream = conn.getInputStream();

Bitmap bitmap = BitmapFactory.decodeStream(inStream);

inStream.close();

conn.disconnect();

The code above runs in the same thread so you’ll lock up your UI until the image has finish loading. Adding the Threading code adds quite a bit more code. So I decided to create an ImageLoader class to make my life just a little easier. Now I can load an image to an ImageView with one line of code.

ImageLoader.getInstance().load(myImageView, «myimage.jpg», true);

The last parameter tells the ImageLoader class to cache that the bitmap.

The ImageLoader class loads images sequentially so you don’t slow your mobile device down to a crawl. To cancel Loading simply call clearQueue() and to clear the cache call clearCache()

Here’s the class

package com.wumedia.net;

import java.io.InputStream;

import java.net.HttpURLConnection;

import java.net.URL;

import java.util.HashMap;

import java.util.Iterator;

import java.util.LinkedList;

import java.util.Queue;

import android.graphics.Bitmap;

import android.graphics.BitmapFactory;

import android.os.Handler;

import android.widget.ImageView;

public class ImageLoader {

static private ImageLoader _instance;

static public ImageLoader getInstance() {

if (_instance == null) {

_instance = new ImageLoader();

}

return _instance;

}

private HashMap _urlToBitmap;

private Queue _queue;

private DownloadThread _thread;

private Bitmap _missing;

private boolean _busy;

/**

* Constructor

*/

private ImageLoader () {

_urlToBitmap = new HashMap();

_queue = new LinkedList();

_busy = false;

}

public Bitmap get(String url) {

return _urlToBitmap.get(url);

}

public void load(ImageView image, String url) {

load(image, url, false);

}

public void load(ImageView image, String url, boolean cache) {

if (_urlToBitmap.get(url) != null) {

if(image!=null) {

image.setImageBitmap(_urlToBitmap.get(url));

}

} else {

image.setImageBitmap(null);

queue(image, url, cache);

}

}

public void queue(ImageView image, String url, boolean cache) {

Iterator it = _queue.iterator();

if (image!=null) {

while (it.hasNext()) {

if (it.next().image.equals(image)) {

it.remove();

break;

}

}

} else if (url!=null) {

while (it.hasNext()) {

if (it.next().url.equals(url)) {

it.remove();

break;

}

}

}

_queue.add(new Group(image, url, null, cache));

loadNext();

}

public void clearQueue() {

_queue = new LinkedList();

}

public void clearCache() {

_urlToBitmap = new HashMap();

}

public void cancel() {

clearQueue();

if ( _thread != null ) {

_thread.disconnect();

_thread = null;

}

}

public void setMissingBitmap(Bitmap bitmap) {

_missing = bitmap;

}

private void loadNext() {

Iterator it = _queue.iterator();

if (!_busy && it.hasNext() ) {

_busy = true;

Group group = it.next();

it.remove();

// double check image availability

if (_urlToBitmap.get(group.url) != null) {

if (group.image!=null) {

group.image.setImageBitmap(_urlToBitmap.get(group.url));

}

_busy = false;

loadNext();

} else {

_thread = new DownloadThread(group);

_thread.start();

}

}

}

private void onLoad() {

if (_thread != null) {

Group group = _thread.group;

if (group.bitmap != null) {

if (group.cache) {

_urlToBitmap.put(group.url, group.bitmap);

}

if (group.image != null) {

group.image.setImageBitmap(group.bitmap);

}

} else if (_missing != null) {

if (group.image != null) {

group.image.setImageBitmap(_missing);

}

}

}

_thread = null;

_busy = false;

loadNext();

}

private class Group {

public Group(ImageView image, String url, Bitmap bitmap, boolean cache) {

this.image = image;

this.url = url;

this.bitmap = bitmap;

this.cache = cache;

}

public ImageView image;

public String url;

public Bitmap bitmap;

public boolean cache;

}

private class DownloadThread extends Thread {

final Handler threadHandler = new Handler();

final Runnable threadCallback = new Runnable() {

public void run() {

onLoad();

}

};

private HttpURLConnection _conn;

public Group group;

public DownloadThread(Group group) {

this.group = group;

}

@Override

public void run() {

InputStream inStream = null;

_conn = null;

try {

_conn = (HttpURLConnection) new URL(group.url).openConnection();

_conn.setDoInput(true);

_conn.connect();

inStream = _conn.getInputStream();

group.bitmap = BitmapFactory.decodeStream(inStream);

inStream.close();

_conn.disconnect();

inStream = null;

_conn = null;

} catch (Exception ex) {

// nothing

}

if (inStream != null) {

try {

inStream.close();

} catch (Exception ex) {}

}

disconnect();

inStream = null;

_conn = null;

threadHandler.post(threadCallback);

}

public void disconnect() {

if (_conn != null) {

_conn.disconnect();

}

}

}

}

» wu-media.com

Remove ugly sound on HTC HERO boot (SuperHero) Июнь 30, 2009

Posted by russenreaktor in android.
Tags: , , ,
add a comment

You should write in your windows console (do not forget install Android SDK)

adb remount
adb shell
#cd /system/media
#rm boot.mp3
#reboot

Alternatively you can replace boot image and sound
http://forum.xda-developers.com/showthread.php?t=508078

Using a Horizontal Progress Bar in Android Июнь 23, 2009

Posted by russenreaktor in android, develop, programming.
Tags: ,
add a comment

«I was working on my Android downloader application yesterday, when I ran into a bit of a snag. I wanted to display a list of downloads (similar to the Firefox downloads window). Each item in the list should show the file name and a horizontal progress bar. I started to implement this, and several hours later stumbled upon the archaic solution. I wanted to share this, both to help anybody who may be trying to do something similar, and also to illustrate how the lack of good documentation is hurting aspiring Android developers.

I thought that I could put a ProgressBar instance in my xml, set it to be indeterminate, give it a max and a value, and be done. However, it wasn’t nearly that easy. After a few hours of hunting on Google and the Android Groups, I stumbled upon the solution in an online preview of The Busy Coder’s Guide to Android Development. In short, I had to set the following on my ProgressBar’s XML:

style="?android:attr/progressBarStyleHorizontal"

WTF?

» http://bytecrafter.blogspot.com/2008/12/using-horizontal-progress-bar-in.html

to get horizontal progressbar just put

<ProgressBar
android:id="@+id/ProgressBar01"
android:indeterminateOnly="false"
android:progressDrawable="@android:drawable/progress_horizontal"
android:indeterminateDrawable="@android:drawable/progress_indeterminate_horizontal"
android:minHeight="20dip"
android:maxHeight="20dip" android:layout_width="fill_parent"></ProgressBar>

into your \res\layout\main.xml

Greasemonkey on steroids for Android Март 12, 2009

Posted by russenreaktor in android.
add a comment

«inserts custom JavaScript for any pages that match a URL pattern. Here’s a script that would insert a «Scan Barcode» button like the one shown earlier:
view plaincopy to clipboardprint?

1. // ==UserScript==
2. // @name Scan barcode into Half.com
3. // @description Add button to Half.com search box to scan barcode
4. // @author Jeffrey Sharkey
5. // @include http://*m.half.com*
6. // ==/UserScript==
7.
8. function generate(item) {
9. var helper = document.createElement(‘input’);
10. helper.type = ‘button’;
11. helper.value = ‘Scan barcode…’;
12. helper.addEventListener(‘click’, function(event) {
13. // use the intentHelper bridge to fire an intent to Barcode Scanner
14. // it’s available in Market, or from http://code.google.com/p/zxing/
15. var result = window.intentHelper.startActivityForResult(JSON.stringify({
16. action:’com.google.zxing.client.android.SCAN’,
17. category:['CATEGORY_DEFAULT']
18. }));
19.
20. // parse the result we get back, and read the barcode from the extras
21. result = JSON.parse(result);
22. item.value = result['extras']['SCAN_RESULT'];
23. }, false);
24. return helper;
25. }
26.
27. // find the ‘query’ form field
28. var items = document.body.getElementsByTagName(‘input’);
29. for(i in items) {
30. var item = items[i];
31. if(item.name == ‘query’) {
32. // build our ’scan barcode’ helper button
33. // then insert it after the query form field
34. var helper = generate(item);
35. item.parentNode.insertBefore(helper, item.nextSibling);
36. }
37. } » oilcan.jsharkey.org

WORKED: Rooting your G1 Март 10, 2009

Posted by russenreaktor in addictive, android, g1.
add a comment

«On RC29 phones and lower, anything you type into your keyboard is also being run in a hidden console with root permissions. More information regarding that at the bottom of this post. But, to get root access, do the following:

Instructions:

1. Download recovery.img and copy it to your SD card (see the previous instructions on how to copy from your computer to your Phone’s SD card).
2. Download the Hard SPL and copy the zip file to the SD card.
3. All files must be on the root of your SD card.
4. Restart your phone. Wait for your phone to start up fully and show the home screen.

5. After your phone starts up, at the home screen, hit the enter key twice, then type «telnetd» and hit enter again. (Yes, it will start up a contact search, don’t worry. Just type it.)
6. Download an Android «Telnet» application from the Market and connect to localhost.
7. If you connect successfully, you will have a root prompt «#».
8. Type the following into Telnet (these commands will give you root access easier in the future):
* mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
* cd sdcard
* flash_image recovery recovery.img
* cat recovery.img > /system/recovery.img

Now you have root!» forum.xda-developers.com