September 12, 2010

[SOLVED] Use github repository under windows with tortoisegit


Generate public and private ssh keys:

Just open "putty key generator" and generate (1) your key by moving your mouse on the surface.
Than wite some comment(2) and secure it with random passphrase (3).
Than save public and private key part on your file system.

Copy ssh-rsa key from "Public key for parsing into OpenSSH authorised_keys file:"- text field (you will need it for the next step)



Adding the key to your GitHub account:

Use this  tutorial http://help.github.com/msysgit-key-setup/

Use Pageant for auto authorisation:

If you dont want to put every time your ssh key password use Pageant. Just start it and add your private key



Get GitHub repository url:

Goto to desired project and copy git url from it:
For example: on http://github.com/stuttgart-gtug/help-me it will be "git@github.com:stuttgart-gtug/help-me.git"



Clone aka "Check Out" the repository:

Now create a folder on your PC and hit right mouse button on it - choose "Git Clone..."



In next dialog put the URL of git repository and choose path to your private github key you generated before.



Now push "OK" and enjoy the ride



Voilà ;)

August 26, 2010

install app to sd card in 2.2 (froyo)

-Go here
--http://developer.android.com/sdk/index.html
and get the SDK for your OS
-Once you download it, unzip it to its own folder, I put it off C:\
-Run the SDK Setup.exe
-Click available Packages, on left, I didn't know what was needed so I installed -EVERYTHING. Although I do suspect that we only need the USB driver, which is at the very bottom.
It will take forever to install.
After it's done installing, I Clicked on Installed Packages, and updated all.


Not done yet.
check that the phone is set up to allow debugging via USB (Settings⇒Applications⇒Development⇒USB debugging)
Plug in your phone
Windows will fail to install the driver.
Go in device manager and and update the newly Yellowed entry, the driver is in:
C:\android-sdk_r06-windows\android-sdk-windows\usb_driver
The driver should install

Start console: "Start"->"Run"->cmd->ENTER

> adb devices
if you see a serial number starting with an "H" that means you got things working, now do the following:
> adb shell pm setInstallLocation 2

This command will push ALL apps to your sd card, to revert back to saving apps to internal memory enter in:


> adb shell pm setInstallLocation 0

Source: install app to sd card in 2.2 (froyo)

July 27, 2010

[SOLVED] PHP: How upload file using cURL?


<?php
$request_url = ‘http://www.akchauhan.com/test.php’;
$post_params['name'] = urlencode(’Test User’);
$post_params['file'] = ‘@’.'demo/testfile.txt’;
$post_params['
submit'] = urlencode(’submit’);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $request_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_params);
$result = curl_exec($ch);
curl_close($ch);
?>


Source: How upload file using cURL?.

July 18, 2010

[SOLVED]Market Slowness and Accessibility on cyanogenmod's CM6 RC1

After upgrading to the latest Cyanogen I notices, that the Android Market is quiet slow and does not show my downloaded apps in the download section. 2 Fixes to repair this:

1) Take the following source and save in file named vending_preferences.xml

<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
<map>
<boolean name="local_db_sync_required" value="false" />
<int name="SERVER_VERSION" value="1000" />
<string name="vending_tos_version">1.0.0</string>
<long name="MARKET_LAST_HEARTBEAT_TIMESTAMP" value="1271657433127" />
<long name="last_sync_time" value="1271659724720" />
<long name="last_tickle_id" value="1271657514775" />
<int name="reconciled_version" value="1710" />
<boolean name="metadata_paid_apps_enabled" value="true" />
<string name="vending_backup_state">vending</string>
<string name="vending_tos_version">1.0.0</string>
</map>

Now push to /data/data/com.android.vending/shared_prefs/vending_preferences.xml :

adb push vending_preferences.xml /data/data/com.android.vending/shared_prefs/vending_preferences.xml

Next you do in a terminal window (device or via adb shell):

su
cd /data/data/com.android.vending/cache
rm *
reboot

Source: MattiDroid - Mobile Blog: N1/G1: Market Slowness and Accessibility.

July 17, 2010

[SOLVED]How customize/extend/ Spinner

You will need to take control over what goes into the ListView and
Spinner. I have not experimented with these techniques on Spinner, but
on ListView, you will need to override getView() (on ArrayAdapter) or
newView() and bindView() (on CursorAdapter).
Here is a free excerpt from one of my books that demonstrates the technique:

http://commonsware.com/Android/excerpt.pdf

In your case, you would use your Typeface object to update the font used
by the TextView widgets in your rows.

In principle, you could do this via a wrapping adapter -- this would be
more reusable but a bit slower. I have an AdapterWrapper base class here:

http://github.com/commonsguy/cwac-adapter

and some projects that use it here:

http://github.com/commonsguy/cwac-endless
http://github.com/commonsguy/cwac-thumbnail


You also need to override getDropDownView().

Source: How to change the Typeface of ListView and Spinner - Android Beginners Google Groups.

July 7, 2010

[SOLVED] Edit SQLite database of your app from your PC

Very nice solution to browse and edit the SQLite database file of your app directly from your PC.

  1. Download

  2. Set right path in settings.ini

  3. start it


java -jar AndroidDBEditor.jar


Or you can create small batch file AndroidDBEditor.bat
@echo off
rem set current path
set CURRENT_PATH=%~dp0

rem replace slashes
set CURRENT_PATH=%CURRENT_PATH:\=/%

echo sqliteeditorpath=%CURRENT_PATH%sqlitebrowser.exe > settings.ini
rem start app
java -jar AndroidDBEditor.jar

Android DB Editor - troido.de its all about android.

July 1, 2010

[SOLVED] Set right permissions for svn repository


Additionally you should set umask 002 while working with a repository so that all new files will be writable by owner and group. This is made mandatory by creating a wrapper script for svn and svnserve:



mv /usr/bin/svn /usr/bin/svn.orig &&
mv /usr/bin/svnserve /usr/bin/svnserve.orig &&
cat >> /usr/bin/svn << "EOF"
#!/bin/sh
umask 002
/usr/bin/svn.orig "$@"

EOF
cat >> /usr/bin/svnserve << "EOF"
#!/bin/sh
umask 002
/usr/bin/svnserve.orig "$@"

EOF
chmod 0755 /usr/bin/svn{,serve}



Source: Running a Subversion Server.

[SOLVED] Fix default protocol (http...) association in WIndows


Setting default browser manually


You can manually set the default browser by selecting it as the the default program for individual file types and protocols, as follows:




  • Windows XP and earlier: Open the Control Panel from the Windows Start menu.

    • In Windows 2000 and earlier, or if Windows XP is using the Control Panel "Classic View": Click on "Folder Options -> File Types".

    • In Windows XP, if using the Control Panel "Category View": Click on "Performance and Maintenance". Then, click on "File Types" in the left column under the heading "See Also".



  • Windows 7 and Vista: Click the Start button, open "Default Programs" and then click "Associate a file type or protocol with a program". For detailed instructions, see the Microsoft article here for Vista or here for Windows 7. Note: On Windows Vista (or above), you may be unable to associate the HTTP HTTPS or FTP protocols with SeaMonkey because it does not appear as an available option. See this forum topic for additional information.


Assign the following protocols and file types to the browser you wish to set as default:




  • URL:HyperText Transfer Protocol (HTTP protocol)

  • URL:HyperText Transfer Protocol with Privacy (HTTPS protocol)

  • URL:File Transfer Protocol {FTP protocol)

  • HTML File

  • HTM File (optional)


In Windows XP and earlier, you can find the URL protocols listed above in File Types, under extension "N/A" or "(NONE)".




Source: Default browser - MozillaZine Knowledge Base.

June 10, 2010

[SOLVED] Convert signing certificate *.crt to *.spc

In order to convert the Certificate(mycert.crt) into a .spc file please run the following command:

openssl crl2pkcs7 -nocrl -certfile mycert.crt -outform DER -out newcertfile.spc

technoninja: thawte signing certificate howto mykey.pvk mycert.spc from .pfx file.

[SOLVED]How do I generate a certificate request with OpenSSL


openssl req \
-new -newkey rsa:1024 -nodes \
-keyout mykey.pem -out myreq.pem

If you’ve already got a key and would like to use it for generating the request, the syntax is a bit simpler.
openssl req -new -key mykey.pem -out myreq.pem



OpenSSL Command-Line HOWTO.

May 23, 2010

[SOLVED] Show web pages in Activity -Hello, WebView

A WebView allows you to create your own web browser Activity. In this tutorial, we'll create a simple Activity that can view web pages.

Source: Hello, WebView | Android Developers.

May 20, 2010

[ANDROD] First screens of froyo. Android 2.2

Desktop screen
desktop

Launcher
desktop

Phone
desktop

Music widget + overwiev of screens
desktop

Select "Input languages" for your multi-language virtual keyboard
desktop

for example german and russian
desktop

last started apps

desktop

our german keyboard

desktop

swipe on spacebar and we will get russian keyboard

desktop

May 9, 2010

[SOLVED] Android: Set Admob programmatically into test mode


(6) When integrating AdMob ads into your application it is recommended to use test mode. In test mode test, ads are always returned.


Test mode is enabled on a per-device basis. To enable test mode for a device, first request an ad, then look in LogCat for a line like the following:



  To get test ads on the emulator use AdManager.setTestDevices...

Once you have the device ID you can enable test mode by calling AdManager.setTestDevices:



  AdManager.setTestDevices( new String[] {                 
AdManager.TEST_EMULATOR, // Android emulator
"E83D20734F72FB3108F104ABC0FFC738", // My T-Mobile G1 Test Phone
} );



Source: Android - Admob For Developers.

May 6, 2010

[SOLVED] Android: hide/disable soft keyboard for activity


Just put stateAlwaysHidden attribute in your Manifest



 <activity name="EditContactActivity"
android:windowSoftInputMode="stateAlwaysHidden">
...
</activity>



Source: The AndroidManifest.xml File </activity>

May 5, 2010

[SOLVED] Android: How to stress/test your app with random streams of user events

The Monkey is a program that runs on your emulator or device and generates pseudo-random streams of user events such as clicks, touches, or gestures, as well as a number of system-level events. You can use the Monkey to stress-test applications that you are developing, in a random yet repeatable manner.


$ adb shell monkey -p your.package.name -v 500



UI/Application Exerciser Monkey Android Developers.

May 2, 2010

[Solved] Android: Check if SD card is present



  1. public static boolean isSdPresent() {

  2. return android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED);

  3. }




Source: Android Snippets: Check if SD card is present.

[SOLVED] How-To HOW TO convert any video to your Nexus One

Source: How-To HOW TO convert any video to your Nexus One - Nexus One Forum - Google Phone Forum.

[SCREENCAST]How to do Unit Testing on Android with Eclipse

Source: How to do Unit Testing on Android with Eclipse - Gubatron.com.

[SOLVED] How to catch changes on "Key Press" from Soft Keyboard in EditText

editText.addTextChangedListener(new TextWatcher());  this interface
contains three methods,  which will be called accordingly when you
type using soft keyboard.





Source: Handling "Key Press" from Soft Keyboard in EditText - Android Developers | Google Groups.

[SOLVED] How to center window title

Just put in onCreate


TextView t=(TextView) findViewById(android.R.id.title);
t.setGravity(Gravity.CENTER_HORIZONTAL);





Alternative solution: http://andmobidev.blogspot.com/2010/01/centering-title-of-window.html

Source: Issue 4395 - android - android:gravity property ignored by TextAppearance.WindowTitle or WindowTitle - Project Hosting on Google Code.