A couple week ago I got a new requirement. My team need to integrate with Instagram which hottest photo social at this time. Now is a good time for summarize how to integrate with Instagram.
If you used to integrate with Facebook, Instagram use same technic is called OAuth.
- You need to Register Your Application to Instagram. then define application name, desc, website, redirectURI and then you will receive 3 important parameters clientId, clientSecret and redirectURI.
- We need accessToken for connect with Instagram. Instagram provide 2 ways (explicit, implicit) for get it. I choose explicit way for more security.
- Redirect user to auth url https://api.instagram.com/oauth/authorize/?client_id=<client-id>&redirect_uri=<redirect-uri>&response_type=code (replace client-id and redirect_uri parameters that you receive from first step).
- Instagram will redirect user to redirectURI that you define in step one.
- Using code parameter from step four and send post request to https://api.instagram.com/oauth/access_token for get userId and accessToken
- You can test fetch user photo by request to https://api.instagram.com/v1/users/<user>/media/recent/?access_token=<access-token> (replace user-id and access-token parameters that you receive from step five)
It’s quite easy, isn’t it ? Let’s fun :DPS. I spend my worth time about 3 hours for integrate with Instagram. I know you can do it’s better than me.Ref: http://instagr.am/developer/authentication/
Well, it’s just a simple tutorial how to make an option menu on android. Hope you like it!
For your information, maybe I’m not a professional android’s programmer, but I just want to learn and share, if you guys have something to share or find any wrong codes from my blog, please inform me, and I will be very glad to know it. :)
Thank you!
For first time make an activity on android we have this code:
public class OptionMenuActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
And now, you have to make a layout xml for your menu, just make it simple we can make 3 menus, on directory res/menu create menu.xml
<?xml version=”1.0” encoding=”utf-8”?>
<menu xmlns:android=”http://schemas.android.com/apk/res/android”>
<item android:id=”@+id/one”
android:title=”One” />
<item android:id=”@+id/two”
android:title=”Two” />
<item android:id=”@+id/three”
android:title=”Three” />
</menu>
And now, return to the main java activity “OptionsMenuActivity.java” add this code, below the main’s code
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu, menu);
return true;
}
If there’s error occurred, just click and import all needed :)
And now, you have a menu options on your screen, but how we can make another action? We need to add another code :)
this code for prepare our action when the menus are pressed, it’s just for showing a dialog code
public void showMessageDialog(final String message)
{
runOnUiThread(new Runnable()
{
public void run()
{
Toast.makeText(getBaseContext(),message,Toast.LENGTH_LONG).show();
}
});
}
and this code for the real pressed action on the menus
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch(item.getItemId()){
case R.id.one:
showMessageDialog(“One”);
return true;
case R.id.two:
showMessageDialog(“Two”);
return true;
case R.id.three:
showMessageDialog(“Three”);
return true;
default:
return false;
}
}
Have a nice try :)
via smashinghub.comPHP is the most widely-used language for programming on the web. If you’re new to PHP, then it’s time to get acquainted with the awesomeness that is the PHP manual. PHP helps creates dynamic web pages with load of functionality. You can improve your PHP with following tips:
You can turn on Error Reporting in PHP that you might not have spotted earlier.You can use IDE’s (Integrated Development Environments) Tools for any Development. It can help you while syntax highlighting, Code Completion, Error Warnings and Refactoring (reworking.
So, in this round up you will find some useful and PHP tutorials that are especially designed for latest technics for developers. We hope that you will get good help from these tutorials. Enjoy!
Smartphones in particular.
Hmm, this question has been bugging me for a while now, especially when I got my Windows phone :3
(Source: mishidems)