Soon, I Will Update this blog with Source Code..............
Wednesday 27 February 2013
Wednesday, February 27, 2013
Sunday 17 February 2013
Sunday, February 17, 2013
Android Dropbox Integration
Hello Droid Guys,
Today, I am going to provide you a full tutorial of dropbox integration into your
android application with source code. Using this you can easily :
1. upload your image in your dropbox.
2. upload your text file and document into your dropbox.
3. upload your audio and video file into your dropbox.
Also , List or fetch all your dropbox file, folder and images by your android application.
Step 1: Create an app and get the API KEY and SECRET KEY:
a) Open this link https://www.dropbox.com/developers and logged in with your
dropbox credential.
Today, I am going to provide you a full tutorial of dropbox integration into your
android application with source code. Using this you can easily :
1. upload your image in your dropbox.
2. upload your text file and document into your dropbox.
3. upload your audio and video file into your dropbox.
Also , List or fetch all your dropbox file, folder and images by your android application.
Step 1: Create an app and get the API KEY and SECRET KEY:
a) Open this link https://www.dropbox.com/developers and logged in with your
dropbox credential.
b) After Logged in , the next page ask you for create an app
C) Insert the app name and description and provide the access as full dropbox by
selecting the second option.
d) Note your app key and secret key
Step 2) Download the android Sdk for dropbox form HERE
Now all Done , import the project into your android eclipse and please remember to
change secret key and App key with your own key.
Hope this will helps you.
Enjoy Coding :)
Saturday 16 February 2013
Saturday, February 16, 2013
android.os.NetworkOnMainThreadException in android
Mukesh Kumar
android Strict mode
,
network call in Main UI Thread
,
network call on main thread
,
NetworkOnMainThreadException
7
comments
Hello Droid Guys,
Yesterday , I found a strange issue, my application is running fine on most of
the android devices. But when I run the same application on Samsung S-3, S2,
Samsung Galaxy Duos it will be crashed and give me the error
"android.os.NetworkOnMainThreadException".
In my application basically I am showing a alert dialog with an logout button and on click of logout
button I am calling the service. This functionality is not working on above few device
and crashes every time on clickinng the logout button .
After spending a lot of time on it I came to know that on device api version below 9 we
can call or write network call in Main UI Thread but above api version 9 it gives error
android.os.NetworkOnMainThreadException. This is happening my case.
There are Two way to fix this Issue:
1.Instead of writing network call in Main UI Thread use Async Task.
2.Add below code into your activity class inside onCreate() method just after the
setContentView(R.layout.activity_main).
if( Build.VERSION.SDK_INT >= 9){
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
}
Hoping , this will helps you.
Enjoy Coding :)
Yesterday , I found a strange issue, my application is running fine on most of
the android devices. But when I run the same application on Samsung S-3, S2,
Samsung Galaxy Duos it will be crashed and give me the error
"android.os.NetworkOnMainThreadException".
Caused by: android.os.NetworkOnMainThreadException
10-30 15:07:35.341: E/AndroidRuntime(732): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1117)
In my application basically I am showing a alert dialog with an logout button and on click of logout
button I am calling the service. This functionality is not working on above few device
and crashes every time on clickinng the logout button .
After spending a lot of time on it I came to know that on device api version below 9 we
can call or write network call in Main UI Thread but above api version 9 it gives error
android.os.NetworkOnMainThreadException. This is happening my case.
There are Two way to fix this Issue:
1.Instead of writing network call in Main UI Thread use Async Task.
2.Add below code into your activity class inside onCreate() method just after the
setContentView(R.layout.activity_main).
if( Build.VERSION.SDK_INT >= 9){
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
}
Hoping , this will helps you.
Enjoy Coding :)
Sunday 20 January 2013
Sunday, January 20, 2013
Android animation
Hello Droid Guys,
In my previous article or blog , i had explain how to show shake animation
in android. Now , in this blog I am covering the other animation.
like:
1, left to right animation in android
2. right to left animation in android
3. fade out animation in android
4. zoom in animation in android
5. slide up animation in android
6. slide down animation in andriod
<translate xmlns:android="http://schemas.android.com/apk/res/android"In my previous article or blog , i had explain how to show shake animation
in android. Now , in this blog I am covering the other animation.
like:
1, left to right animation in android
2. right to left animation in android
3. fade out animation in android
4. zoom in animation in android
5. slide up animation in android
6. slide down animation in andriod
1.res/anim/slideoutleft.xml
<?xml version="1.0" encoding="utf-8"?>
android:duration="@integer/fastAnim"
android:fromXDelta="0"
android:interpolator="@android:anim/overshoot_interpolator"
android:toXDelta="-100%p" />
2. res/anim/slideinright.xml
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@integer/fastAnim"
android:fromXDelta="100%p"
android:interpolator="@android:anim/overshoot_interpolator"
android:toXDelta="0" />
3.res/anim/fadeout.xml
<?xml version="1.0" encoding="utf-8"?>
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@integer/fastAnim"
android:fromAlpha="1.0"
android:toAlpha="0.0" />
Another link
1. Shake animation in android
1. Shake animation in android
Sunday, January 20, 2013
Android Shake animation
Mukesh Kumar
fade in and fade out animation in android
,
left to right animation in android
,
right to left animation in android
,
slide down animation in andriod
,
slide up animation in android
1 comment
Hello Droid Friends,
This is my another android blog in which I am going to explain the Animation
effect(shake Animation ) in android. When you fill wrong input then instead of
showing the toast messege you can also shake the view.
Steps :
1. Create a project with name "Shake animation" and package name
"com.mukesh.shakeanimation".
2. add an "anim" folder inside the res folder.see the image below.
Source Code:
1. Activity Class:
2) activity_main.xml
4. res/anim/cycle_7.xml
May this will helps someone.
Enjoy coding :)
Following link also helps you :
1. left to right animation in android
2. right to left animation in android
3. fade out animation in android
4. zoom in animation in android
5. slide up animation in android
6. slide down animation in andriod
This is my another android blog in which I am going to explain the Animation
effect(shake Animation ) in android. When you fill wrong input then instead of
showing the toast messege you can also shake the view.
Steps :
1. Create a project with name "Shake animation" and package name
"com.mukesh.shakeanimation".
2. add an "anim" folder inside the res folder.see the image below.
Source Code:
1. Activity Class:
package com.mukesh.shakeanimation;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Toast;
public class MainActivity extends Activity implements View.OnClickListener {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
View loginButton = findViewById(R.id.login);
loginButton.setOnClickListener(this);
}
public void onClick(View v) {
Animation shake = AnimationUtils.loadAnimation(this, R.anim.shake);
findViewById(R.id.pw).startAnimation(shake);
Toast.makeText(this, "Wrong Password", Toast.LENGTH_SHORT).show();
}
}
2) activity_main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/blue_gradient"
android:orientation="vertical"
android:padding="10dip" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dip"
android:text="Please enter your password:"
android:textColor="@android:color/white"
android:textStyle="bold" />
<EditText
android:id="@+id/pw"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:password="true"
android:singleLine="true" />
<Button
android:id="@+id/login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/btn_active_pressed"
android:padding="5dp"
android:text="Login"
android:textColor="@android:color/white"
android:textStyle="bold" />
</LinearLayout>
3. res/anim/shake.xml
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="500"
android:fromXDelta="0"
android:interpolator="@anim/cycle_7"
android:toXDelta="10" />
<cycleInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
android:cycles="7" />
May this will helps someone.
Enjoy coding :)
Following link also helps you :
1. left to right animation in android
2. right to left animation in android
3. fade out animation in android
4. zoom in animation in android
5. slide up animation in android
6. slide down animation in andriod
Subscribe to:
Posts
(
Atom
)