Sunday, April 6, 2014

BitTorrent Beta v1 3 Android App Apk Free Download

BitTorrent Beta v1.3
Requirements: Android 2.1+
Overview: Find torrents and get them directly to your smartphone. From BitTorrent!
Welcome to the first official BitTorrent App for Android (Beta version 1.3). 

Find torrents and get them directly to your smartphone. From BitTorrent!

Welcome to the first official BitTorrent App for Android (Beta version 1.3).


Find torrents and get them directly to your smartphone or tablet - all with this handy BitTorrent app from the team that invented the BitTorrent protocol over a decade ago. Subscribe to RSS feeds, play content and more. The first generation of this powerful new app is designed to be easy-to-use, super-fast, and make your Android device so much more fun.

BitTorrent for Android (Beta) is currently free, and best of all, theres no speed or size limits! To get the best performance and avoid running up your data charges, we recommend taking advantage of WiFi whenever possible.

Because this is an early beta version, your feedback is very important to us. Please email us directly if you have any problems or requests. Thank you in advance!

More Info:


Code:

https://play.google.com/store/apps/details?id=com.bittorrent.client

Download Instructions:
DOWNLOAD LINK

Mirror:
DOWNLOAD LINK

Read More..

Google Maps Android API v2 example detect user touch on GoogleMap and animate to the clicked location

Modify from last eample "Set map type of GoogleMap" to detect user click on GoogleMap, and animate to the user clicked location.

Google Maps Android API v2 example: detect user touch on GoogleMap and animate to the clicked location


To detect user click event on GoogleMap, modify the FragmentActivity implements OnMapClickListener, override onMapClick(LatLng point), and call myMap.setOnMapClickListener(this).

To animated to a specified location, create a new CameraUpdate by calling CameraUpdateFactory.newLatLng(point) method with the specified location. And then call myMap.animateCamera(...) to start animation to the specified location.

package com.example.androidmapsv2;

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.GoogleMap.OnMapClickListener;
import com.google.android.gms.maps.model.LatLng;

import android.app.AlertDialog;
import android.location.Location;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends FragmentActivity implements OnMapClickListener{

final int RQS_GooglePlayServices = 1;
private GoogleMap myMap;

Location myLocation;
TextView tvLocInfo;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

tvLocInfo = (TextView)findViewById(R.id.locinfo);

FragmentManager myFragmentManager = getSupportFragmentManager();
SupportMapFragment mySupportMapFragment
= (SupportMapFragment)myFragmentManager.findFragmentById(R.id.map);
myMap = mySupportMapFragment.getMap();

myMap.setMyLocationEnabled(true);

myMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
//myMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
//myMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
//myMap.setMapType(GoogleMap.MAP_TYPE_TERRAIN);

myMap.setOnMapClickListener(this);


}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_legalnotices:
String LicenseInfo = GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(
getApplicationContext());
AlertDialog.Builder LicenseDialog = new AlertDialog.Builder(MainActivity.this);
LicenseDialog.setTitle("Legal Notices");
LicenseDialog.setMessage(LicenseInfo);
LicenseDialog.show();
return true;
}
return super.onOptionsItemSelected(item);
}

@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();

int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext());

if (resultCode == ConnectionResult.SUCCESS){
Toast.makeText(getApplicationContext(),
"isGooglePlayServicesAvailable SUCCESS",
Toast.LENGTH_LONG).show();
}else{
GooglePlayServicesUtil.getErrorDialog(resultCode, this, RQS_GooglePlayServices);
}

}

@Override
public void onMapClick(LatLng point) {
tvLocInfo.setText(point.toString());
myMap.animateCamera(CameraUpdateFactory.newLatLng(point));
}

}


Modify layout file to add a TextView to display the clicked location.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity" >

<TextView
android:id="@+id/locinfo"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"/>

</LinearLayout>


download filesDownload the files.

Next:
- Detect long click on map and add marker


The series:
A simple example using Google Maps Android API v2, step by step.

Read More..

Saturday, April 5, 2014

Simple MySql Injection

Ok, I liked to create websites and, at the beginning I didnt know almost anything about security, sessions, MySql Injection, I heard only about md5 and I thought that only crypting a password with md5 will be enough. But not!
First, I learn about sessions in PHP, then about "cleaning" a string and finally about MySql Injection. I remember that one day one of my friends tried to hack my databases and he failed... Why? Simple using of md5, sessions, and sanitizing my string.

So, first of all I give an example! If you have a simple script without md5 or anything, something like:

$username=$_POST[username];
$password=$_POST[password];
$login = mysql_query("SELECT * FROM user WHERE (username = $username) and (password =$password)");

if you try to input OR= as username and as pasword, youll access the database without any problem, with the username of the first user from table. Nice, right?

Ok... but now let try adding a function, like mysql_real_escape_string(). The example would look now like this:

$username=mysql_real_escape_string($_POST[username]);
$password=mysql_real_escape_string($_POST[password]);
$login = mysql_query("SELECT * FROM user WHERE (username = $username) and (password =$password)");
and if you input OR= youll have a surprise.
Ok, but now lets encrypt that login... so, Ill add sessions and md5.

And if you want the full login script that I used on my website and at all websites that I created, you can find it HERE.
Read More..

Example to draw Bitmap with ShadowLayer

In the below screen capture, the background bitmap is draw normally, the upper left bitmap of Rubber Duck is draw using Paint with ShadowLayer, the middle one is the shadow layer of the Rubber Duck bitmap.

Example to draw Bitmap with ShadowLayer


package com.test.androidimageprocessing;

import java.io.FileNotFoundException;

import android.net.Uri;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.example.androidimageprocessing.R;

public class MainActivity extends Activity {

Button btnLoadImage1, btnLoadImage2;
TextView textSource1, textSource2;
Button btnProcessing;
ImageView imageResult;

final int RQS_IMAGE1 = 1;
final int RQS_IMAGE2 = 2;

Uri source1, source2;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btnLoadImage1 = (Button)findViewById(R.id.loadimage1);
btnLoadImage2 = (Button)findViewById(R.id.loadimage2);
textSource1 = (TextView)findViewById(R.id.sourceuri1);
textSource2 = (TextView)findViewById(R.id.sourceuri2);
btnProcessing = (Button)findViewById(R.id.processing);
imageResult = (ImageView)findViewById(R.id.result);

btnLoadImage1.setOnClickListener(new OnClickListener(){

@Override
public void onClick(View arg0) {
Intent intent = new Intent(Intent.ACTION_PICK,
android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intent, RQS_IMAGE1);
}});

btnLoadImage2.setOnClickListener(new OnClickListener(){

@Override
public void onClick(View arg0) {
Intent intent = new Intent(Intent.ACTION_PICK,
android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intent, RQS_IMAGE2);
}});

btnProcessing.setOnClickListener(new OnClickListener(){

@Override
public void onClick(View v) {

if(source1 != null && source2 != null){
Bitmap processedBitmap = ProcessingBitmap();
if(processedBitmap != null){
imageResult.setImageBitmap(processedBitmap);
Toast.makeText(getApplicationContext(),
"Done",
Toast.LENGTH_LONG).show();
}else{
Toast.makeText(getApplicationContext(),
"Something wrong in processing!",
Toast.LENGTH_LONG).show();
}
}else{
Toast.makeText(getApplicationContext(),
"Select both image!",
Toast.LENGTH_LONG).show();
}

}});
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(resultCode == RESULT_OK){
switch (requestCode){
case RQS_IMAGE1:
source1 = data.getData();
textSource1.setText(source1.toString());
break;
case RQS_IMAGE2:
source2 = data.getData();
textSource2.setText(source2.toString());
break;
}
}
}

private Bitmap ProcessingBitmap(){
Bitmap bm1 = null;
Bitmap bm2 = null;
Bitmap newBitmap = null;

try {
bm1 = BitmapFactory.decodeStream(
getContentResolver().openInputStream(source1));
bm2 = BitmapFactory.decodeStream(
getContentResolver().openInputStream(source2));

int w;
if(bm1.getWidth() >= bm2.getWidth()){
w = bm1.getWidth();
}else{
w = bm2.getWidth();
}

int h;
if(bm1.getHeight() >= bm2.getHeight()){
h = bm1.getHeight();
}else{
h = bm2.getHeight();
}

Config config = bm1.getConfig();
if(config == null){
config = Bitmap.Config.ARGB_8888;
}

newBitmap = Bitmap.createBitmap(w, h, config);
Canvas newCanvas = new Canvas(newBitmap);

newCanvas.drawBitmap(bm1, 0, 0, null);

Paint paint = new Paint();
paint.setShadowLayer(50.0f, 200.0f, 100.0f, 0xFF000000);
newCanvas.drawBitmap(bm2, 0, 0, paint);

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

return newBitmap;
}

}


The layout file refer to the post "Combine bitmap side-by-side".


download filesDownload the files.



more: Something about processing images in Android

Read More..

Friday, April 4, 2014

Rotating Button Development in Android


This example shows how Control and animate Buttons in android.
Algorithm:
1.) Create a new project by File-> New -> Android Project name it RotatingButtonExample.
2.) Write following into main.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:orientation="vertical"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:id="@+id/container"
   android:splitMotionEvents="true"
   >



    <LinearLayout
       android:orientation="horizontal"
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       android:layout_marginTop="20dip"
       android:splitMotionEvents="true"
       >
        <TextView
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:paddingLeft="5dip"
           android:paddingRight="5dip"
           android:textStyle="bold"
           android:text="TX"
           />
        <SeekBar
           android:orientation="horizontal"
           android:layout_weight="1"
           android:layout_width="match_parent"
           android:layout_height="wrap_content"
           android:id="@+id/translationX"
       />
        <TextView
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:paddingLeft="15dip"
           android:paddingRight="5dip"
           android:textStyle="bold"
           android:text="TY"
           />
        <SeekBar
           android:orientation="horizontal"
           android:layout_weight="1"
           android:layout_width="match_parent"
           android:layout_height="wrap_content"
           android:id="@+id/translationY"
       />
    </LinearLayout>
    <LinearLayout
       android:orientation="horizontal"
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       android:layout_marginTop="20dip"
       android:splitMotionEvents="true"
       >
        <TextView
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:paddingLeft="5dip"
           android:paddingRight="5dip"
           android:textStyle="bold"
           android:text="SX"
           />
        <SeekBar
           android:orientation="horizontal"
           android:layout_weight="1"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:id="@+id/scaleX"
       />
        <TextView
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:paddingLeft="15dip"
           android:paddingRight="5dip"
           android:textStyle="bold"
           android:text="SY"
           />
        <SeekBar
           android:orientation="horizontal"
           android:layout_weight="1"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:id="@+id/scaleY"
       />
    </LinearLayout>
    <LinearLayout
       android:orientation="horizontal"
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       android:layout_marginTop="20dip"
       android:splitMotionEvents="true"
       >
        <TextView
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:paddingLeft="5dip"
           android:paddingRight="5dip"
           android:textStyle="bold"
           android:text="X"
           />
        <SeekBar
           android:orientation="horizontal"
           android:layout_weight="1"
           android:layout_width="match_parent"
           android:layout_height="wrap_content"
           android:id="@+id/rotationX"
       />
        <TextView
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:paddingLeft="15dip"
           android:paddingRight="5dip"
           android:textStyle="bold"
           android:text="Y"
           />
        <SeekBar
           android:orientation="horizontal"
           android:layout_weight="1"
           android:layout_width="match_parent"
           android:layout_height="wrap_content"
           android:id="@+id/rotationY"
       />
        <TextView
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:paddingLeft="15dip"
           android:paddingRight="5dip"
           android:textStyle="bold"
           android:text="Z"
           />
        <SeekBar
           android:orientation="horizontal"
           android:layout_weight="1"
           android:layout_width="match_parent"
           android:layout_height="wrap_content"
           android:id="@+id/rotationZ"
       />
    </LinearLayout>
    <Button
       android:layout_width="200dip"
       android:layout_height="150dip"
       android:layout_marginLeft="50dip"
       android:layout_marginTop="50dip"
       android:text="Click Me"
       android:id="@+id/rotatingButton"
       />
</LinearLayout>
3.) Run for output.
Steps:
1.) Create a project named RotatingButtonExample and set the information as stated in the image.
Build Target: Android 4.0
Application Name: RotatingButtonExample
Package Name: com. example. RotatingButtonExample
Activity Name: RotatingButtonExample
Min SDK Version: 14
2.) Open RotatingButtonExample.java file and write following code there:
package com.example.RotatingButtonsExample;
import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;
import android.widget.SeekBar;
public class RotatingButtonsExample extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        final Button rotatingButton = (Button) findViewById(R.id.rotatingButton);
        SeekBar seekBar;
        seekBar = (SeekBar) findViewById(R.id.translationX);
        seekBar.setMax(400);
        seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener(){
            public void onStopTrackingTouch(SeekBar seekBar) {
            }
            public void onStartTrackingTouch(SeekBar seekBar) {
            }
            public void onProgressChanged(SeekBar seekBar, int progress,
                    boolean fromUser) {
                rotatingButton.setTranslationX((float)progress);
            }
        });
        seekBar = (SeekBar) findViewById(R.id.translationY);
        seekBar.setMax(800);
        seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener(){
            public void onStopTrackingTouch(SeekBar seekBar) {
            }
            public void onStartTrackingTouch(SeekBar seekBar) {
            }
            public void onProgressChanged(SeekBar seekBar, int progress,
                    boolean fromUser) {
                rotatingButton.setTranslationY((float)progress);
            }
        });
        seekBar = (SeekBar) findViewById(R.id.scaleX);
        seekBar.setMax(50);
        seekBar.setProgress(10);
        seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener(){
            public void onStopTrackingTouch(SeekBar seekBar) {
            }
            public void onStartTrackingTouch(SeekBar seekBar) {
            }
            public void onProgressChanged(SeekBar seekBar, int progress,
                    boolean fromUser) {
                rotatingButton.setScaleX((float)progress/10f);
            }
        });
        seekBar = (SeekBar) findViewById(R.id.scaleY);
        seekBar.setMax(50);
        seekBar.setProgress(10);
        seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener(){
            public void onStopTrackingTouch(SeekBar seekBar) {
            }
            public void onStartTrackingTouch(SeekBar seekBar) {
            }
            public void onProgressChanged(SeekBar seekBar, int progress,
                    boolean fromUser) {
                rotatingButton.setScaleY((float)progress/10f);
            }
        });
        seekBar = (SeekBar) findViewById(R.id.rotationX);
        seekBar.setMax(360);
        seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener(){
            public void onStopTrackingTouch(SeekBar seekBar) {
            }
            public void onStartTrackingTouch(SeekBar seekBar) {
            }
            public void onProgressChanged(SeekBar seekBar, int progress,
                    boolean fromUser) {
                rotatingButton.setRotationX((float)progress);
            }
        });
        seekBar = (SeekBar) findViewById(R.id.rotationY);
        seekBar.setMax(360);
        seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener(){
            public void onStopTrackingTouch(SeekBar seekBar) {
            }
            public void onStartTrackingTouch(SeekBar seekBar) {
            }
            public void onProgressChanged(SeekBar seekBar, int progress,
                    boolean fromUser) {
                rotatingButton.setRotationY((float)progress);
            }
        });
        seekBar = (SeekBar) findViewById(R.id.rotationZ);
        seekBar.setMax(360);
        seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener(){
            public void onStopTrackingTouch(SeekBar seekBar) {
            }
            public void onStartTrackingTouch(SeekBar seekBar) {
            }
            public void onProgressChanged(SeekBar seekBar, int progress,
                    boolean fromUser) {
                rotatingButton.setRotation((float)progress);
            }
        });
    }
}
3.) Compile and build the project.
Output
Read More..