tag:blogger.com,1999:blog-46184068942129869452024-03-08T07:35:06.505-08:00stomping groundZip Chttp://www.blogger.com/profile/00008406684877171415noreply@blogger.comBlogger15125tag:blogger.com,1999:blog-4618406894212986945.post-21071879856519026582013-01-07T18:24:00.005-08:002013-01-07T18:25:38.428-08:00Connecting Android to Apache on localhostSometimes the requirements given to client/s are a bit odd especially when you are working as a freelance. In my previous android projects, apps that requires internet permissions is as easy as what on the android documentation says. Recently, I've got a project that uses internet to fetch updates. The resources that I have are a site and a mysql database. Now, I have to setup this site into local and run some tests on localhost. In order for you to connect your android device to access localhost, make sure your laptop and android device are on the same wifi network. You need to get the ip address of your localhost. To do this, execute this command:<br />
<br />
<pre class="brush:plain">$ ifconfig
</pre>
<br />
This is a utility used by system administrators to display and analyze network interface parameters. Result should display like the image below.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-8tsGRvef2NA/UOuA6ouInDI/AAAAAAAAAPs/oSym2VVSej4/s1600/ifconfig.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="285" src="http://3.bp.blogspot.com/-8tsGRvef2NA/UOuA6ouInDI/AAAAAAAAAPs/oSym2VVSej4/s400/ifconfig.png" width="400" /></a></div>
<br />
The ip address of the laptop is at the wlan0 which is 192.168.1.35. We may have different results depending on how many devices connected on wifi. You may have something like 192.168.1.xx. So on your test device, try changing the localhost to your ip address.<br />
<br />
<pre class="brush:java">WebView webview = (WebView) findViewById(R.id.webview);
webview.setWebViewClient(new WebViewClient());
webview.loadUrl("http://192.168.1.35/drupal/");
</pre>
<br />
Thanks to this <a href="http://stackoverflow.com/questions/4394439/getting-android-to-talk-to-apache-on-localhost">post</a> at StackOverflow.Zip Chttp://www.blogger.com/profile/00008406684877171415noreply@blogger.com9tag:blogger.com,1999:blog-4618406894212986945.post-64235825410692730362013-01-03T21:11:00.002-08:002013-01-03T21:11:39.311-08:00Android Terminal Emulator Crashes on cm-10.1 [Part 1]After I installed the <a href="http://get.cm/?device=p970">cm-10.1</a> on LGE p970 and tested it, it was pretty fast and smooth except for 2 things.<br />
<br />
<ol>
<li><a href="https://play.google.com/store/apps/details?id=jackpal.androidterm">Android Terminal Emulator</a> (ATE) app crashes on launch.</li>
<li>People app couldn't find vcard during import even though it exists on the root directory of the sdcard.</li>
</ol>
<div>
The ATE is a very important tool (at least for me). I always use this during development and hacking. I prefer to work and debug things <a href="http://stompnground.blogspot.com/2012/06/adb-over-wifi.html">wirelessly</a>. So this article is about tweaking android and stuffs that I wanted them to behave.</div>
<div>
<br /></div>
<div>
<b>The Cause</b>. Before I flashed cm-10.1, I remembered updating the ATE from Google Play. During testing cm-10.1, the app crashes. Finding the cause was easy. First, I checked the stack trace. Here's what the stack trace said.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-cb2QDiOWG-Q/UOZal1Qzr8I/AAAAAAAAAPc/j1Z2EUK2vU8/s1600/stack-trace.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-cb2QDiOWG-Q/UOZal1Qzr8I/AAAAAAAAAPc/j1Z2EUK2vU8/s1600/stack-trace.png" height="240" width="400" /></a></div>
<div>
<br /></div>
<div>
Serioulsy? This wasn't clear to me at all. Second, I went to Google Play and found out that ATE is an open source project hosted at github. From there, I browsed the issues before doing stupid things (i.e. asking solutions from developers or posting it in the issue tracker) and found this interesting issue (same as mine).</div>
<div>
<br /></div>
<div>
issue <a href="https://github.com/jackpal/Android-Terminal-Emulator/issues/133">#133</a> Force close on start (UnsatisfiedLinkError)</div>
<div>
<br /></div>
<div>
It says,</div>
<blockquote class="tr_bq">
I think if you install the apk into /system/app, the library loader needs the native library in /system/lib. (If you install to /data via the normal route, the package manager unpacks any native libraries in the package to /data/data/package.name/lib, and the library loader will look there also.)Basically, either extract libjackpal-androidterm4.so from the apk and install it to /system/lib, or install the package normally and let the package manager deal with this for you. This isn't a bug in ATE.</blockquote>
By reading this comment, everything is now clear.<br />
<br />
<b>So What Happened</b>? By reading the first line of the stack trace,<br />
<br />
<pre class="brush:plain">java.lang.UnsatisfiedLinkError: Couldn't load jackpal-androidterm4 from loader dalvik.system.PathClassLoader[dexPath=/system/app/Term.apk,libraryPath=/data/data/jackpal-androidterm/lib]: findLibrary returned null
</pre>
<br />
the system couldn't load a shared library in<br />
<br />
<pre class="brush:plain">jackpal-androidterm.so
</pre>
<br />
in the library path,<br />
<br />
<pre class="brush:plain">libraryPath=/data/data/jackpal.androidterm/lib
</pre>
<br />
this makes sense because after I update ATE, its path changed to /data/data/jackal.androidterm. Since cm-10, ATE is preconfigured in the rom so path should be
<br />
<br />
<pre class="brush:plain">libraryPath=/system/lib
</pre>
<br />
as mentioned in the comment, extract jackpal-androidterm4.so from the apk and push it into /system/lib. I haven't try this yet so I'll post it on the next series.Zip Chttp://www.blogger.com/profile/00008406684877171415noreply@blogger.com0tag:blogger.com,1999:blog-4618406894212986945.post-11985734883702360522012-12-19T02:42:00.003-08:002012-12-19T02:46:33.844-08:00Filter logcat Output by Tag NamesWhen debugging on android development, sometimes it is hard to find what we need when there are too much data displays on logcat. Most of the time when I do debugging on android, I use the terminal. It's pretty fast and I find it more comfortable than the logcat from Eclipse android plugin. Sometimes I missed out important data because there are unnecessary information displayed on logcat. So what I do is to <a href="http://stompnground.blogspot.com/2012/07/save-logcat-to-file.html">save the logcat into a file</a> and check it into a browser. This is time consuming though you have all the information. One way to sort out this problem is to filter logcat. adb logcat command has the option to filter your tags that you define in your application.
In your code, you might have something similar like this:
<pre class="brush:java">
private static final String TAG = "Fragment01";
Log.d(TAG, "getUserVisibleHint=" + getUserVisibleHint());
</pre>
To display "Fragment01" in logcat,
<pre class="brush:plain">
$ adb logcat -s "Fragment01"
</pre>
But this information isn't enough. What if you also need to see the values of fragment 2? or fragment 3? and etc.? Run this command.
<pre class="brush:plain">
$ adb logcat -s "Fragment01" "Fragment02" "Fragment03"
</pre>
By adding the tag names on the command this will allow adb to filter it and display in logcat.
Do you have some ideas similar to this? Glad if you could share. Let me know your thoughts.Zip Chttp://www.blogger.com/profile/00008406684877171415noreply@blogger.com0tag:blogger.com,1999:blog-4618406894212986945.post-74721085824894116822012-09-21T02:56:00.002-07:002012-09-21T02:56:42.449-07:00USB Debugging on Samsung Galaxy Tab Using UbuntuIf you are developing android applications using either the Samsung Galaxy Tab 7" or the 10.1", chances are you'll have a hard time using <b>adb</b> to these devices. If you have followed these <a href="http://developer.android.com/tools/device.html#setting-up" target="_blank">instructions</a> in the android developer site and you find it working for you, then congratulations! In my case, it's different. Restarting the <b>udev</b> and <b>adb</b> doesn't work for me. When I try the command <b>adb devices</b>, it shows,<br />
<br />
<pre class="brush:plain">
$ adb devices
List of devices attached
???????????? device
</pre>
<br />
and if I check the devices attached to my machine using <b>lsusb</b> it shows,<br />
<br />
<pre class="brush:plain">
$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 003: ID 0a5c:21bc Broadcom Corp. BCM2070 Bluetooth 2.1 + EDR
Bus 001 Device 005: ID 04e8:6860 Samsung Electronics Co., Ltd GT-I9100 Phone [Galaxy S II]
</pre>
<br />
Samsung handles these attached devices differently. I'm still not sure what causes this but it has something to do with the <a href="http://en.wikipedia.org/wiki/Media_Transfer_Protocol" target="_blank">MTP</a> (Mobile Transfer Protocol). So what I did, I googled for answers and found this answer from <a href="http://android.stackexchange.com/a/17581" target="_blank">stack exchange</a>. Thanks to this guy a.k.a <a href="http://android.stackexchange.com/users/440/flow" target="_blank">Flow</a>. I guess this may work for you. So go ahead and check his answer and don't forget to upvote it.<br />
Zip Chttp://www.blogger.com/profile/00008406684877171415noreply@blogger.com0tag:blogger.com,1999:blog-4618406894212986945.post-36403399221255927412012-09-04T00:57:00.006-07:002012-09-04T00:57:57.286-07:00Is Unity3D Supported On Your Ubuntu?One way to check if Unity3D is supported in your Ubuntu, open a terminal and type this command<br />
<br />
$ /usr/lib/nux/unity_support_test -p<br />
<br />
Result should tell if Unity3D is supported like the image below.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-iq3vzexW9os/UEW0HeFsFxI/AAAAAAAAANQ/svum4Mjq_iU/s1600/unity3d.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="276" src="http://3.bp.blogspot.com/-iq3vzexW9os/UEW0HeFsFxI/AAAAAAAAANQ/svum4Mjq_iU/s400/unity3d.png" width="400" /></a></div>
<br />
Do you have any tips on how to tell if you're on Unity3D? Glad if you share.Zip Chttp://www.blogger.com/profile/00008406684877171415noreply@blogger.com0tag:blogger.com,1999:blog-4618406894212986945.post-51811316293089841682012-08-29T18:53:00.003-07:002012-08-29T21:03:43.879-07:00ActionBarSherlock and ViewPagerIndicator Pattern for Pre-HoneyComb DevicesDownload the libraries:<br />
<a href="http://actionbarsherlock.com/" target="_blank">ActionBarSherlock</a><br />
<a href="http://viewpagerindicator.com/" target="_blank">ViewPagerIndicator</a><br />
<br />
Extract the zip files. These libraries are packaged with sample codes. Import these libraries into your Eclipse projects.<br />
<br />
Create your new project. I assume that you are an Eclipse user and not new to android development. Add these libraries to your project as a <a href="http://developer.android.com/tools/projects/projects-eclipse.html#SettingUpLibraryProject" target="_blank">library project</a>. By adding these libraries to your new project, you are telling Android that you are using ActionBarSherlock and ViewPagerIndicator as part of your android project.<br />
<br />
To check if libraries are added, go to Project Properties > Android. It should look like this:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-H4PwSDNXmRw/UD7CXPhZIJI/AAAAAAAAAMw/MxiGfe8EjMQ/s1600/Selection_005.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="137" src="http://1.bp.blogspot.com/-H4PwSDNXmRw/UD7CXPhZIJI/AAAAAAAAAMw/MxiGfe8EjMQ/s400/Selection_005.png" width="400" /></a></div>
<br />
<br />
If you encountered an error like this, it's okay don't panic.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-cBoKIT8amoE/UD7AY-1xnjI/AAAAAAAAAMo/IcMoXOzPhS4/s1600/Selection_004.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="140" src="http://2.bp.blogspot.com/-cBoKIT8amoE/UD7AY-1xnjI/AAAAAAAAAMo/IcMoXOzPhS4/s640/Selection_004.png" width="640" /></a></div>
This tells that Eclipse detected android-support-v4.jar file in the dependecy list of your project twice but with different SHA-1 hash. To fix this, just remove the file under <your_projectname>/libs/android-support-v4.jar<br />
<br />
Now let's proceed to the fun part... the code.<br />
<br />
layout xml.<br />
<pre class="brush:plain"><linearlayout android:layout_height="fill_parent" android:layout_width="fill_parent" android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android">
<com .viewpagerindicator.titlepageindicator=".viewpagerindicator.titlepageindicator" android:id="@+id/title_indicator" android:layout_height="wrap_content" android:layout_width="fill_parent" android:padding="10dp">
</com>
<android .support.v4.view.viewpager=".support.v4.view.viewpager" android:id="@+id/view_pager" android:layout_height="0dp" android:layout_weight="1" android:layout_width="fill_parent">
</android>
</linearlayout>
</pre>
<br />
MainActivity.java<br />
<pre class="brush:java">package com.zipcerio.vpi;
import java.util.ArrayList;
import java.util.List;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.view.Menu;
import com.viewpagerindicator.TitlePageIndicator;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
public class MainActivity extends SherlockFragmentActivity {
private ViewPager mPager;
private TitlePageIndicator mIndicator;
private MainPagerAdapter mAdapter;
private List<fragment> mFragments;
private static final String FRAGMENT1 = Fragment1.class.getName();
private static final String FRAGMENT2 = Fragment1.class.getName();
private static final String FRAGMENT3 = Fragment1.class.getName();
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.a_main);
// add fragments
mFragments = new ArrayList<fragment>();
mFragments.add(Fragment.instantiate(this, FRAGMENT1));
mFragments.add(Fragment.instantiate(this, FRAGMENT2));
mFragments.add(Fragment.instantiate(this, FRAGMENT3));
// adapter
mAdapter = new MainPagerAdapter(getSupportFragmentManager(), mFragments);
// pager
mPager = (ViewPager) findViewById(R.id.view_pager);
mPager.setAdapter(mAdapter);
// indicator
mIndicator = (TitlePageIndicator) findViewById(R.id.title_indicator);
mIndicator.setViewPager(mPager);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
return true;
}
}
</fragment></fragment></pre>
<br />
MainPagerAdapter.java<br />
<pre class="brush:java">package com.zipcerio.vpi;
import java.util.List;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
public class MainPagerAdapter extends FragmentPagerAdapter {
private List<fragment> mFragments;
private String[] titles = new String[] {"FRAGMENT1", "FRAGMENT2", "FRAGMENT3"};
private int mCount = titles.length;
public MainPagerAdapter(FragmentManager fm, List<fragment> f) {
super(fm);
mFragments = f;
}
@Override
public Fragment getItem(int position) {
return mFragments.get(position);
}
@Override
public int getCount() {
return mCount;
}
@Override
public CharSequence getPageTitle(int position) {
return titles[position];
}
}
</fragment></fragment></pre>
<br />
Fragment1.java<br />
<pre class="brush:java">package com.zipcerio.vpi;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import com.actionbarsherlock.app.SherlockFragment;
public class Fragment1 extends SherlockFragment {
private ListView mList;
@Override
public View onCreateView(LayoutInflater inf, ViewGroup grp, Bundle icicle) {
View v = inf.inflate(R.layout.f_fragment1, grp, false);
mList = (ListView) v.findViewById(R.id.listView1);
return v;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
ArrayAdapter<string> adapter = new ArrayAdapter<string>(
getActivity(), android.R.layout.simple_list_item_1, Cheese.STRINGS);
mList.setAdapter(adapter);
}
}
</string></string></pre>
<br />
AndroidManifest file<br />
<pre class="brush:plain"><manifest android:versioncode="1" android:versionname="1.0" package="com.zipcerio.vpi" xmlns:android="http://schemas.android.com/apk/res/android">
<uses -sdk="-sdk" android:minsdkversion="8" android:targetsdkversion="15">
<application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/Theme.Sherlock">
<activity android:label="@string/title_activity_main" android:name=".MainActivity">
<intent -filter="-filter">
<action android:name="android.intent.action.MAIN">
<category android:name="android.intent.category.LAUNCHER">
</category></action></intent>
</activity>
</application>
</uses></manifest>
</pre>
<br />
Finally, this is how it should look like. <br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-IvOGQdjAQBs/UD7JAnkjaRI/AAAAAAAAANA/jWaedt6HtRw/s1600/Selection_006.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="http://2.bp.blogspot.com/-IvOGQdjAQBs/UD7JAnkjaRI/AAAAAAAAANA/jWaedt6HtRw/s400/Selection_006.png" width="241" /></a></div>
<br />
See the source code <a href="https://github.com/zipcerio/abs_vpi" target="_blank">here</a>.<br />
<br />
Credit goes to Jake Wharton for these great libraries.<br />
Github: <a href="https://github.com/JakeWharton">https://github.com/JakeWharton</a><br />
Twitter: <a href="https://twitter.com/JakeWharton">https://twitter.com/JakeWharton</a><br />
StackOverflow: <a href="http://stackoverflow.com/users/132047/jake-wharton">http://stackoverflow.com/users/132047/jake-wharton</a>Zip Chttp://www.blogger.com/profile/00008406684877171415noreply@blogger.com0tag:blogger.com,1999:blog-4618406894212986945.post-47477225887143716212012-08-29T17:58:00.002-07:002012-08-29T17:58:40.757-07:00Check CPU Information and SpeedTo check CPU information and speed on your Ubuntu or any Linux distro, open the terminal and run this command:<br />
<br />
<pre class="brush:plain">
$ cat /proc/cpuinfo
</pre>
<br />
If you have other techniques and ways, please feel free to add it in the comments.Zip Chttp://www.blogger.com/profile/00008406684877171415noreply@blogger.com0tag:blogger.com,1999:blog-4618406894212986945.post-43339173060600813462012-08-10T01:50:00.002-07:002012-08-10T01:50:49.049-07:00Multiple Workspaces in EclipseIf you're on the point where all your projects are flooded on your Eclipse package explorer, chances are very difficult to find other library projects when working on a project that references those projects. One way to organize your Eclipse projects is to switch workspaces. To switch workspaces, go to Eclipse > File > Switch Workspace.<br />
<br />
This is a great solution but you will loose all your settings. Settings like keybindings, code formats, and custom templates are gone. To set the settings to your new workspace, just copy the folder from your old workspace to your new workspace.<br />
<br />
<pre class="brush:plain">
$ cp {old_workspace}/.metadata/.plugins/.org.eclipse.core.runtime/.settings {new_workspace}/
</pre>
<br />
Restart Eclipse.Zip Chttp://www.blogger.com/profile/00008406684877171415noreply@blogger.com0tag:blogger.com,1999:blog-4618406894212986945.post-61737596144693889862012-07-30T19:27:00.000-07:002012-07-30T19:27:24.968-07:00Google App EngineGoogle App Engine (GAE) lets you run web applications on Google infrastructure. The good thing in this technology is that there's no need for you to maintain the server. You can also use this technology as backend to your android applications (it means that this provides the data exchange between your android application, application server, and GCM). You can run Java, Go, and Python environments for your web application environment. This article will tackle Java and Android stuffs. More of this stuff can be found <a href="https://developers.google.com/appengine/docs/whatisgoogleappengine" target="_blank">here</a>.<br />
<br />
To send/receive JSON data for an Android application.<br />
In this article, I use Eclipse on Ubuntu for the development.<br />
<br />
<h2>
Installation</h2>
Download the Google App Engine SDK for Java <a href="https://developers.google.com/appengine/downloads#Google_App_Engine_SDK_for_Java" target="_blank">here</a>.<br />
<br />
In Eclipse, go to Help > Install New Software > Work With textbox, get the Eclipse update site url <a href="https://developers.google.com/eclipse/docs/download" target="_blank">here</a>.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-TFHokMonDnQ/UATQ-RGI8yI/AAAAAAAAALg/Ldi-K-eF7Is/s1600/Screenshot+from+2012-07-17+10:34:22.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="185" src="http://4.bp.blogspot.com/-TFHokMonDnQ/UATQ-RGI8yI/AAAAAAAAALg/Ldi-K-eF7Is/s400/Screenshot+from+2012-07-17+10:34:22.png" width="400" /></a></div>
<br />
Right after the installation, Google plugin is added in the Eclipse toolbar.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/--h024KHQvBE/UATSoY-0gKI/AAAAAAAAALo/btRFaWcucl4/s1600/Screenshot+from+2012-07-17+10:46:01.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="126" src="http://3.bp.blogspot.com/--h024KHQvBE/UATSoY-0gKI/AAAAAAAAALo/btRFaWcucl4/s400/Screenshot+from+2012-07-17+10:46:01.png" width="400" /></a></div>
<br />
Now you can<br />
<br />
<h2>
Creating and Running a Web Application</h2>
To create a sample web application, click on the Google plugin then select 'New Web Application Project' and click 'Finish'. A sample Hello World code is provided in your new web application project. To Run, hit on Run button, Run As > Web Application. Check and see your browser. Your web application project is hosted locally. The url is <span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">http://localhost:8888</span>.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-pKbXzIWa-Is/UATYWPZrK_I/AAAAAAAAAL0/nv11zXMGZPk/s1600/Screenshot+from+2012-07-17+11:11:43.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="112" src="http://2.bp.blogspot.com/-pKbXzIWa-Is/UATYWPZrK_I/AAAAAAAAAL0/nv11zXMGZPk/s320/Screenshot+from+2012-07-17+11:11:43.png" width="320" /></a></div>
<br />
Then deploy this project in GAE. To deploy, click the Google plugin and click Deploy To App Engine > App Engine Project Settings > enter your ProjectId in the Application ID textbox > hit OK > Deploy<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-LBNYu8WwRGk/UATb4dcPbMI/AAAAAAAAAMA/wwybCpM8wws/s1600/Screenshot+from+2012-07-17+11:25:53.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="345" src="http://3.bp.blogspot.com/-LBNYu8WwRGk/UATb4dcPbMI/AAAAAAAAAMA/wwybCpM8wws/s400/Screenshot+from+2012-07-17+11:25:53.png" width="400" /></a></div>
<br />
Once deployment is successful, you can see something like this image below.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-WcSt6wBZk24/UAT3Ev8PX1I/AAAAAAAAAMM/4kJgZo2CtL0/s1600/Screenshot+from+2012-07-17+13:22:47.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="225" src="http://2.bp.blogspot.com/-WcSt6wBZk24/UAT3Ev8PX1I/AAAAAAAAAMM/4kJgZo2CtL0/s320/Screenshot+from+2012-07-17+13:22:47.png" width="320" /></a></div>
<br />Zip Chttp://www.blogger.com/profile/00008406684877171415noreply@blogger.com0tag:blogger.com,1999:blog-4618406894212986945.post-33833560101459475102012-07-30T19:25:00.000-07:002012-07-30T19:25:18.154-07:00Save logcat to a FileTo save a logcat into a file, simply open the terminal and run this command<br />
<br />
<pre class="brush:plain">
$ adb logcat -d > filename.txt
</pre>
<br />
where filename.txt is any name you want.Zip Chttp://www.blogger.com/profile/00008406684877171415noreply@blogger.com0tag:blogger.com,1999:blog-4618406894212986945.post-63865414205421077522012-06-16T19:42:00.001-07:002012-06-16T19:46:53.149-07:00ADB Over WifiWhen you are doing android development and you don't have the usb adapter with you, there's a way to use adb by tweaking your device using adb over wifi. To do this, your device must be rooted. I'm using <a href="http://get.cm/" target="_blank">CyanogenMod</a> and this tweak is part of the features. First, enable the <b>ADB Over Wifi</b> then restart the device.<br />
<div>
<br /></div>
<div>
Once restarted go to your Terminal Emulator.<br />
<pre class="brush:plain">$ su
# setprop service.adb.tcp.port 5555
# stop adbd
# start adbd
</pre>
<br />
<div>
On your computer, </div>
<pre class="brush:plain">$ adb connect 192.168.1.48:8000
</pre>
<br />
<div>
The ip address on the example is the ip address of your device. If you don't know how to get the ip address of your device, here's a quick step. Go to Settings > Wireless & Networks > Wifi Settings > select the network that you're connected to.</div>
</div>
<div>
<br /></div>
<div>
And you should be connected! Now you can proceed with android development without worrying your usb adapter.<br />
<br />
<br />
More detailed info <a href="http://forum.xda-developers.com/showthread.php?t=1685736" target="_blank">here</a>.</div>Zip Chttp://www.blogger.com/profile/00008406684877171415noreply@blogger.com0tag:blogger.com,1999:blog-4618406894212986945.post-86046440013903612292012-06-13T22:54:00.000-07:002012-06-13T22:54:05.069-07:00Setting Android Environment VariableWhen debugging android applications, I always use the terminal to check the logcat but using it I still have to go to tools directory under android sdk. It's very inconvenient for me since I cannot use the android commands in other directories. By default, setting up the android sdk into Eclipse for the first time, ANDROID_HOME environment variable isn't setup by linux file system. To setup,<br />
<br />
open the terminal and edit the .bashrc file and add these lines at the end of the file:<br />
<pre class="brush:plain">
ANDROID_HOME=/home/path_to_/android-sdk-linux
export ANDROID_HOME
</pre>
<br />
and then append this to the current PATH<br />
<pre class="brush:plain">
PATH=$PATH:$JAVA_HOME/bin:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
export PATH
</pre>
<br />
The tools and platform-tools directory are the most important here since they contain all the <i>android-related</i> commands.Zip Chttp://www.blogger.com/profile/00008406684877171415noreply@blogger.com0tag:blogger.com,1999:blog-4618406894212986945.post-36938301134953621292012-06-10T17:26:00.001-07:002012-06-10T17:26:18.190-07:00Add Workspaces in Unity 2DIn Lucid Lynx, I am used to work with 6 workspaces and each workspace has its own function. One workspace for Chrome, one for Eclipse, one for the Terminal (logcat), one for the Android Emulator, and the other one for Pidgin. I am an LTS user and I wasn't bothered by other releases (Maverick Meerkat, Natty Narwhal, Oneiric Ocelot) until when Precise Pangolin was released, the desktop was changed from GNOME to Unity interface. Now I upgraded my Lynx to the new LTS Pangolin on both my desktop and laptop.<br />
<br />
I experienced different issues on desktop and on my laptop with the Unity interface. The first look into Unity from desktop and laptop puzzled me. On desktop, I can change the size of the launcher to 32 and add more workspaces in it. Glad I found MyUnity, a tweaking tool for Unity desktop. On laptop, I see no options to change the launcher size. MyUnity only works on Unity 3D. Now this made me think that my laptop has Unity 2D. Then I did my research and found this <a href="http://www.webupd8.org/2012/04/things-to-tweak-after-installing-ubuntu.html" target="_blank">tweak</a>.<br />
<br />
On terminal:<br />
<pre class="brush:plain">
$ wget http://webupd8.googlecode.com/files/script.py
$ chmod +x script.py
$ sudo ./script.py 32
</pre>
<br />
The '32' changes your icon launcher size to minimum. Now to add more workspaces to your Unity desktop, I also found this <a href="http://gconftool-2%20-s%20-t%20integer%20/apps/metacity/general/num_workspaces" target="_blank">tweak</a>.<br />
<br />
On terminal, you have change thru gconf and run this command:<br />
<pre class="brush:plain">
$ gconftool-2 -s -t integer /apps/metacity/general/num_workspaces 6
</pre>
<br />
Restart your machine.<br />
<br />
Do you have any alternatives? Glad if you share. Just add it in the comments.Zip Chttp://www.blogger.com/profile/00008406684877171415noreply@blogger.com0tag:blogger.com,1999:blog-4618406894212986945.post-31940478451653013682012-05-22T21:48:00.000-07:002012-06-10T17:23:20.574-07:00Setup Multiple Devices for Android DevelopmentI didn't find good resources in setting up multiple devices for android development. When using Windows, if devices are plugged in via usb, it automatically installs the driver. In Linux, it's different. You have to do it manually. Good example is in Android Developer <a href="http://developer.android.com/guide/developing/device.html" target="_blank">page</a> but this doesn't answer my problem. I have my LG device and 2 of our test devices at work (HTC and Samsung Galaxy Tab). So I have to test it myself and here's what I did.<br />
<br />
Go to rules.d directory<br />
<pre class="brush:plain">$ home_dir/etc/udev/rules.d
</pre>
<br />
Create a file for each device<br />
<pre class="brush:plain">$ vim 51-android.rules
$ vim 61-android.rules
$ vim 71-android.rules
</pre>
<br />
On the content, change the ATTR{idVendor} to specific USB Vendor IDs<br />
For LG<br />
<pre class="brush:plain">SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0666", GROUP="plugdev"
</pre>
<br />
Lastly, change the file permission<br />
<pre class="brush:plain">chmod a+r /etc/udev/rules.d/51-android.rules
</pre>
<br />
Restart udev<br />
<pre class="brush:plain">$ sudo restart udev
</pre>
<br />
To check, use adb command.<br />
<pre class="brush:plain">android_sdk_dir$ ./adb devices
List of devices attached
emulator-5554 device
HT115HL12346 device
46411929E53773CE device
</pre>
It should display the list of devices...<br />
<br />
<br />
Do you have any other methods? Put it on the comments.Zip Chttp://www.blogger.com/profile/00008406684877171415noreply@blogger.com0tag:blogger.com,1999:blog-4618406894212986945.post-84749888527542496782012-04-17T23:16:00.005-07:002012-05-22T21:00:41.164-07:00Hello World!<pre class="brush:java">
Toast.makeText(context, "Hello World", Toast.LENGTH_LONG).show();
</pre>Zip Chttp://www.blogger.com/profile/00008406684877171415noreply@blogger.com0