tag:blogger.com,1999:blog-29534374386918793752024-03-05T08:59:30.870-08:00AndroidForBeginnersUnknownnoreply@blogger.comBlogger38125tag:blogger.com,1999:blog-2953437438691879375.post-68980522500042545132019-10-22T04:37:00.001-07:002021-12-15T03:29:06.644-08:00Test DeepLink<div dir="ltr" style="text-align: left;" trbidi="on">
Click the below link<br />
<a href="https://deeplink.flutter.dev/">https://deeplink.flutter.dev</a><br />
<a href="https://deeplink.flutter.dev/?param=link1">https://deeplink.flutter.dev?param=link1</a><br />
<a href="https://deeplink.flutter.dev/?param=link2">https://deeplink.flutter.dev?param=link2</a><br />
<a href="poc://deeplink.flutter.dev">poc://deeplink.flutter.dev</a><br />
<a href="poc://deeplink.flutter.dev?param=link1">poc://deeplink.flutter.dev?param=link1</a><br />
poc://deeplink.flutter.dev?param=link2<br />
<a href="cop://link.flutter.dev">cop://link.flutter.dev</a><br />
<a href="cop://link.flutter.dev?param=link2">cop://link.flutter.dev?param=link2</a><br />
<a href="cop://link.flutter.dev?param=link2"></a><br />
<pre style="background-color: white; font-family: Menlo; font-size: 9pt;"><span style="color: green; font-weight: bold;"><a href="cop://link.flutter.dev?callback_url='poc://deeplink.flutter.dev">cop://link.flutter.dev?callback_url=poc://deeplink.flutter.dev</a></span></pre><pre style="background-color: white; font-family: Menlo; font-size: 9pt;"><br /></pre><pre style="background-color: white; font-family: Menlo; font-size: 9pt;"><a href="app://rjr.pathway">app://rjr.pathway</a></pre>
<br />
<a href="poc://deeplink.flutter.dev?param=link2"></a><br />
<br /></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2953437438691879375.post-18137353510757755292014-02-04T18:36:00.000-08:002014-02-04T18:36:02.575-08:00Service to Play Audio File<div dir="ltr" style="text-align: left;" trbidi="on">
public class MyService extends Service{<br />
<br />
MediaPlayer player;<br />
<br />
public IBinder onBind(Intent arg0) {<br />
return null;<br />
}<br />
/*This Service used for Playing Music when any task is coming*/<br />
public void onCreate()<br />
{<br />
super.onCreate();<br />
<br />
player = MediaPlayer.create(MyService.this, R.raw.iphone_4s_new_2011);<br />
player.start();<br />
player.setLooping(true);<br />
<br />
System.out.println("songggggggggggggggggggggggggggggggggggggggggggg");<br />
}<br />
<br />
@Override<br />
public void onDestroy()<br />
{<br />
super.onDestroy();<br />
player.stop();<br />
player.release(); <br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
}<br />
<br />
startService(new Intent(this, MyService.class));</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2953437438691879375.post-84460965452115236272014-01-22T02:47:00.001-08:002014-01-22T02:48:23.939-08:00Enable GPS Dialog<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
Below Code display a dilog to enable gps if it is turned off<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPf52WX1PMN51YxiPI3B42PDbqYbaq_ChQ_ZLv2SPW5Nc3kEye9FWLAkwI8KTUL27MQJrvEEyQb2C9fKcpTJdoW0xXX3rZ2fknY714R4Q8gaPszc2qwZAxerb0mUHT0hy-F2yC3dYwvrgU/s1600/enablegps.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPf52WX1PMN51YxiPI3B42PDbqYbaq_ChQ_ZLv2SPW5Nc3kEye9FWLAkwI8KTUL27MQJrvEEyQb2C9fKcpTJdoW0xXX3rZ2fknY714R4Q8gaPszc2qwZAxerb0mUHT0hy-F2yC3dYwvrgU/s1600/enablegps.png" height="320" width="192" /></a></div>
<br />
<br />
public class MainActivity extends Activity {<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>@Override<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>protected void onCreate(Bundle savedInstanceState) {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>super.onCreate(savedInstanceState);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>setContentView(R.layout.activity_main);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>getGPSInfo();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>@Override<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public boolean onCreateOptionsMenu(Menu menu) {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>// Inflate the menu; this adds items to the action bar if it is present.<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>getMenuInflater().inflate(R.menu.main, menu);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>return true;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>private void getGPSInfo() {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>Criteria criteria = new Criteria();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>String provider;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>Location location;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>LocationManager locationmanager = (LocationManager) this<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>.getSystemService(Context.LOCATION_SERVICE);<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (locationmanager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>provider = locationmanager.getBestProvider(criteria, false);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>location = locationmanager.getLastKnownLocation(provider);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>} else {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>showGPSDisabledAlertToUser();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>private void showGPSDisabledAlertToUser() {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(MainActivity.this);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>alertDialogBuilder<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>.setMessage(<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>"GPS is disabled in your device. Would you like to enable it?")<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>.setCancelable(false)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>.setPositiveButton("Goto Settings Page To Enable GPS",<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>new DialogInterface.OnClickListener() {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public void onClick(DialogInterface dialog, int id) {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>Intent callGPSSettingIntent = new Intent(<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>startActivity(callGPSSettingIntent);<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>});<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>alertDialogBuilder.setNegativeButton("Cancel",<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>new DialogInterface.OnClickListener() {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public void onClick(DialogInterface dialog, int id) {<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>dialog.cancel();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>});<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>AlertDialog alert = alertDialogBuilder.create();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>alert.show();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}// ;<br />
<br />
}<br />
<br />
You need to put following permissions in your manifestfile<br />
<br />
<br />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/><br />
</div>
Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-2953437438691879375.post-9947046225875201262013-10-30T02:07:00.000-07:002013-10-30T02:07:19.176-07:00Stop EditText from gaining focus at Activity startup<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<pre class="default prettyprint prettyprinted" style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 0px; vertical-align: baseline;"><span class="com" style="background-color: transparent; border: 0px; color: grey; margin: 0px; padding: 0px; vertical-align: baseline;"><!-- Dummy item to prevent AutoCompleteTextView from receiving focus --></span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"><LinearLayout</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="atn" style="background-color: transparent; border: 0px; color: red; margin: 0px; padding: 0px; vertical-align: baseline;">android:focusable</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="atv" style="background-color: transparent; border: 0px; color: blue; margin: 0px; padding: 0px; vertical-align: baseline;">"true"</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="atn" style="background-color: transparent; border: 0px; color: red; margin: 0px; padding: 0px; vertical-align: baseline;">android:focusableInTouchMode</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="atv" style="background-color: transparent; border: 0px; color: blue; margin: 0px; padding: 0px; vertical-align: baseline;">"true"</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="atn" style="background-color: transparent; border: 0px; color: red; margin: 0px; padding: 0px; vertical-align: baseline;">android:layout_width</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="atv" style="background-color: transparent; border: 0px; color: blue; margin: 0px; padding: 0px; vertical-align: baseline;">"0px"</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="atn" style="background-color: transparent; border: 0px; color: red; margin: 0px; padding: 0px; vertical-align: baseline;">android:layout_height</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="atv" style="background-color: transparent; border: 0px; color: blue; margin: 0px; padding: 0px; vertical-align: baseline;">"0px"</span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;">/></span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="com" style="background-color: transparent; border: 0px; color: grey; margin: 0px; padding: 0px; vertical-align: baseline;"><!-- :nextFocusUp and :nextFocusLeft have been set to the id of this component
to prevent the dummy from receiving focus again --></span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"><AutoCompleteTextView</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="atn" style="background-color: transparent; border: 0px; color: red; margin: 0px; padding: 0px; vertical-align: baseline;">android:id</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="atv" style="background-color: transparent; border: 0px; color: blue; margin: 0px; padding: 0px; vertical-align: baseline;">"@+id/autotext"</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="atn" style="background-color: transparent; border: 0px; color: red; margin: 0px; padding: 0px; vertical-align: baseline;">android:layout_width</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="atv" style="background-color: transparent; border: 0px; color: blue; margin: 0px; padding: 0px; vertical-align: baseline;">"fill_parent"</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="atn" style="background-color: transparent; border: 0px; color: red; margin: 0px; padding: 0px; vertical-align: baseline;">android:layout_height</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="atv" style="background-color: transparent; border: 0px; color: blue; margin: 0px; padding: 0px; vertical-align: baseline;">"wrap_content"</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="atn" style="background-color: transparent; border: 0px; color: red; margin: 0px; padding: 0px; vertical-align: baseline;">android:nextFocusUp</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="atv" style="background-color: transparent; border: 0px; color: blue; margin: 0px; padding: 0px; vertical-align: baseline;">"@id/autotext"</span><span class="pln" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="atn" style="background-color: transparent; border: 0px; color: red; margin: 0px; padding: 0px; vertical-align: baseline;">android:nextFocusLeft</span><span class="pun" style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="atv" style="background-color: transparent; border: 0px; color: blue; margin: 0px; padding: 0px; vertical-align: baseline;">"@id/autotext"</span><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;">/></span></code></pre>
<pre class="default prettyprint prettyprinted" style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 0px; vertical-align: baseline;"><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;">
</span></code></pre>
<pre class="default prettyprint prettyprinted" style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 0px; vertical-align: baseline;"><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;">
</span></code></pre>
<pre class="default prettyprint prettyprinted" style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 0px; vertical-align: baseline;"><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;">
</span></code></pre>
<pre class="default prettyprint prettyprinted" style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 0px; vertical-align: baseline;"><span class="tag" style="background-color: transparent; border: 0px; color: maroon; margin: 0px; padding: 0px; vertical-align: baseline;"><a href="http://stackoverflow.com/questions/1555109/stop-edittext-from-gaining-focus-at-activity-startup">http://stackoverflow.com/questions/1555109/stop-edittext-from-gaining-focus-at-activity-startup</a></span></code></pre>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2953437438691879375.post-33889711974039744202013-10-22T11:57:00.002-07:002013-10-22T11:58:24.897-07:00Android Google oauth2 Sample Code<div dir="ltr" style="text-align: left;" trbidi="on">
This is a sample code to create Goolge User authentication in android<br />
<a href="https://docs.google.com/file/d/0B4VB68bpH6x3QmZZY2RZeHBkcGc/edit?usp=sharing" target="_blank">Click here</a> to dowmload the code<br />
<br />
Referal links<br />
<a href="http://developer.android.com/google/play-services/auth.html">http://developer.android.com/google/play-services/auth.html</a><br />
<br />
<a href="http://developer.android.com/reference/com/google/android/gms/auth/GoogleAuthUtil.html">http://developer.android.com/reference/com/google/android/gms/auth/GoogleAuthUtil.html</a><br />
<br />
<br /></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2953437438691879375.post-72013050459217710392013-10-19T07:11:00.002-07:002013-10-29T04:43:59.225-07:00Android GCM PushNotification Testing<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
Some time we need to simulate push notification into our android device for testing purpose .<br />
This facilty is still not provided into inbuilt android sdk .<br />
But same can be achived from online api testing site called <a href="http://hurl.it/">Hurl.it</a><br />
<br />
Below are steps for that<br />
<br />
Step 1 : In the <b>Destination</b> combo box select<b> Post</b><br />
<br />
Step 2: Click on<b> Add headers button</b> and put the following values for name and vale<br />
<b> name</b> = "Authorization" <b>value</b>= "key=YOU_GOOGLE_API_KEY"<br />
<b>name</b>="Content-Type" <b>value </b>="application/json"<br />
Step 3: Click on <b>Add Body</b> and put the json values into following format<br />
<br />
Step 4 :put "<a href="https://android.googleapis.com/gcm/send" style="background-color: #fefefe; background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 131, 253) !important; direction: ltr !important; float: none !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 16px; height: auto !important; left: auto !important; line-height: 17.59375px; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-decoration: initial; top: auto !important; vertical-align: baseline !important; white-space: pre; width: auto !important;">https://android.googleapis.com/gcm/send</a>" in url filed<br />
<br />
<span style="background-color: white; color: #729fcf; font-family: 'DejaVu Sans Mono', 'Courier New', monospace; font-size: 11px; line-height: 17px;">{</span><br />
<ul style="background-color: white; font-family: 'DejaVu Sans Mono', 'Courier New', monospace; font-size: 11px; line-height: 17px; list-style-type: none; margin: 0px; padding: 0px 0px 0px 20px;">
<li><span class="property" style="color: #204a87;">"<span class="p collapsible">registration_ids</span>"</span>:<span class="array"><span class="toggle" style="border: 1px solid transparent; color: #a40000; cursor: pointer;">[</span><ol style="list-style-type: none; margin: 0px; padding: 0px 0px 0px 20px;">
<li><span class="string" style="color: #4e9a06;">"sdfsdfsdf"</span>,</li>
<li><span class="string" style="color: #4e9a06;">"GCM REGISTRATION TOEKM OF YOUR DEVICE"</span></li>
</ol>
<span card="2" class="toggle-end" style="color: #a40000;">]</span></span>,</li>
<li><span class="property" style="color: #204a87;">"<span class="p collapsible">data</span>"</span>:<span class="object"><span class="toggle" style="border: 1px solid transparent; color: #729fcf; cursor: pointer;">{</span><ul style="list-style-type: none; margin: 0px; padding: 0px 0px 0px 20px;">
<li><span class="property" style="color: #204a87;">"<span class="p">message</span>"</span>:<span class="string" style="color: #4e9a06;">"testing"</span>,</li>
<li><span class="property" style="color: #204a87;">"<span class="p">usertype</span>"</span>:<span class="string" style="color: #4e9a06;">"driver"</span>,</li>
<li><span class="property" style="color: #204a87;">"<span class="p">bookingid</span>"</span>:<span class="string" style="color: #4e9a06;">"8"</span></li>
</ul>
<span class="toggle-end" style="color: #729fcf;">}</span></span></li>
</ul>
<span class="toggle-end" style="background-color: white; color: #729fcf; font-family: 'DejaVu Sans Mono', 'Courier New', monospace; font-size: 11px; line-height: 17px;">}</span><br />
<h4 style="background-color: white; color: #061427; font-family: 'PT Sans', Helvetica, Arial, sans-serif; font-size: 17.5px; line-height: 20px; margin: 0px 0px 10px; text-rendering: optimizelegibility;">
<span style="color: #204a87; font-family: 'DejaVu Sans Mono', 'Courier New', monospace; font-size: 11px; font-weight: normal; line-height: 17px;">registration_ids and data are mandatory fields and under data u can send any string data </span></h4>
<div>
<span style="color: #204a87; font-family: 'DejaVu Sans Mono', 'Courier New', monospace; font-size: 11px; font-weight: normal; line-height: 17px;"><br /></span></div>
<div>
Step 4: click on Launch Request</div>
<div>
<br /></div>
<div>
You can see the response in following formate</div>
<div>
<br /></div>
<div>
<span class="b" style="background-color: white; color: #444444; font-family: 'PT Sans', Helvetica, Arial, sans-serif; font-size: 16px; font-weight: bold; line-height: 20px; white-space: pre-wrap;">{</span><span class="ell" style="background-color: white; color: #444444; font-family: 'PT Sans', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 20px; white-space: pre-wrap;"></span><span class="blockInner" style="background-color: white; border-left-color: rgb(187, 187, 187); border-left-style: dotted; border-left-width: 1px; color: #444444; display: block; font-family: 'PT Sans', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 20px; margin-left: 2px; padding-left: 24px; white-space: pre-wrap;"><span class="kvov objProp" style="display: block; margin-left: -20px; padding-left: 20px; position: relative;">"<span class="k" style="color: black;">multicast_id</span>": <span class="n" style="color: #1a01cc; font-weight: bold;">4635199670770759000</span>,</span><span class="kvov objProp" style="display: block; margin-left: -20px; padding-left: 20px; position: relative;">"<span class="k" style="color: black;">success</span>": <span class="n" style="color: #1a01cc; font-weight: bold;">1</span>,</span><span class="kvov objProp" style="display: block; margin-left: -20px; padding-left: 20px; position: relative;">"<span class="k" style="color: black;">failure</span>": <span class="n" style="color: #1a01cc; font-weight: bold;">1</span>,</span><span class="kvov objProp" style="display: block; margin-left: -20px; padding-left: 20px; position: relative;">"<span class="k" style="color: black;">canonical_ids</span>": <span class="n" style="color: #1a01cc; font-weight: bold;">0</span>,</span><span class="kvov objProp" style="display: block; margin-left: -20px; padding-left: 20px; position: relative;"><span class="e" style="background-image: url(data:image/png; background-position: 50% 50%; background-repeat: no-repeat no-repeat; display: block; height: 18px; left: -2px; opacity: 0.15; position: absolute; top: 1px; width: 20px; z-index: 5;"></span>"<span class="k" style="color: black;">results</span>": <span class="b" style="font-weight: bold;">[</span><span class="ell"></span><span class="blockInner" style="border-left-color: rgb(187, 187, 187); border-left-style: dotted; border-left-width: 1px; display: block; margin-left: 2px; padding-left: 24px;"><span class="kvov arrElem" style="display: block; margin-left: -20px; padding-left: 20px; position: relative;"><span class="e" style="background-image: url(data:image/png; background-position: 50% 50%; background-repeat: no-repeat no-repeat; display: block; height: 18px; left: -2px; opacity: 0.15; position: absolute; top: 1px; width: 20px; z-index: 5;"></span><span class="b" style="font-weight: bold;">{</span><span class="ell"></span><span class="blockInner" style="border-left-color: rgb(187, 187, 187); border-left-style: dotted; border-left-width: 1px; display: block; margin-left: 2px; padding-left: 24px;"><span class="kvov objProp" style="display: block; margin-left: -20px; padding-left: 20px; position: relative;">"<span class="k" style="color: black;">error</span>": <span class="s" style="color: #0b7500; word-wrap: break-word;">"InvalidRegistration"</span></span></span><span class="b" style="font-weight: bold;">}</span>,</span><span class="kvov arrElem" style="display: block; margin-left: -20px; padding-left: 20px; position: relative;"><span class="e" style="background-image: url(data:image/png; background-position: 50% 50%; background-repeat: no-repeat no-repeat; display: block; height: 18px; left: -2px; opacity: 0.15; position: absolute; top: 1px; width: 20px; z-index: 5;"></span><span class="b" style="font-weight: bold;">{</span><span class="ell"></span><span class="blockInner" style="border-left-color: rgb(187, 187, 187); border-left-style: dotted; border-left-width: 1px; display: block; margin-left: 2px; padding-left: 24px;"><span class="kvov objProp" style="display: block; margin-left: -20px; padding-left: 20px; position: relative;">"<span class="k" style="color: black;">message_id</span>": <span class="s" style="color: #0b7500; word-wrap: break-word;">"0:1382190107462279%63ac093bf9fd7ecd"</span></span></span><span class="b" style="font-weight: bold;">}</span></span></span><span class="b" style="font-weight: bold;">]</span></span></span><span class="b" style="background-color: white; color: #444444; font-family: 'PT Sans', Helvetica, Arial, sans-serif; font-size: 16px; font-weight: bold; line-height: 20px; white-space: pre-wrap;">}</span></div>
<h4 style="background-color: white; color: #061427; font-family: 'PT Sans', Helvetica, Arial, sans-serif; font-size: 17.5px; line-height: 20px; margin: 0px 0px 10px; text-rendering: optimizelegibility;">
</h4>
</div>
Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-2953437438691879375.post-39239779614709929272013-10-01T23:28:00.002-07:002013-10-01T23:28:23.095-07:00Android Custom autocomplete<div dir="ltr" style="text-align: left;" trbidi="on">
Below is the sample code for a cuatom Autocomplete EditText in android<br />
<a href="https://docs.google.com/file/d/0B4VB68bpH6x3R1NfeHpEbk5qaDQ/edit?usp=sharing" target="_blank">click here</a> to download the sample code<br />
<br /></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2953437438691879375.post-87688871917474396022013-10-01T22:04:00.000-07:002013-10-01T22:04:49.628-07:00Android Custom Receiver<div dir="ltr" style="text-align: left;" trbidi="on">
Following is the sample code to create a custom Broadcast Reciever (Local receiver ) in android.<br />
<a href="https://docs.google.com/file/d/0B4VB68bpH6x3YUgwbFp5WnhYV28/edit?usp=sharing" target="_blank">Clikc here</a> to download the sample code</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2953437438691879375.post-60790431040119312812013-09-28T07:40:00.001-07:002013-09-28T07:51:12.982-07:00Android UI design patterns<div dir="ltr" style="text-align: left;" trbidi="on">
Below are some links whcih gives a brief and good idea for UI design patterns used in android<br />
<br />
1.<a href="http://www.androidpatterns.com/">http://www.androidpatterns.com/</a><br />
<br />
2.<a href="http://android-developers.blogspot.in/2010/05/twitter-for-android-closer-look-at.html">http://android-developers.blogspot.in/2010/05/twitter-for-android-closer-look-at.html</a><br />
<br />
3.<a href="http://www.androiduipatterns.com/">http://www.androiduipatterns.com/</a><br />
<br />
<br />
<br />
<br /></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2953437438691879375.post-86821432724675474202013-09-23T10:19:00.002-07:002013-10-02T04:30:08.022-07:00Android Usefull Lirbarys<div dir="ltr" style="text-align: left;" trbidi="on">
1.<b><a href="https://github.com/xballoy/twitter-login-button/blob/master/README.md" target="_blank">Android Twitter Button</a></b><br />
<br />
2<span style="color: blue;">.<b><a href="http://loopj.com/android-async-http/" target="_blank">Android HTTP library</a></b></span><br />
<a href="http://code.google.com/p/android-query/wiki/AsyncAPI" target="_blank"><span style="color: blue;"> </span>http://code.google.com/p/android-query/wiki/AsyncAPI</a><br />
<br />
3.<b><a href="https://github.com/nostra13/Android-Universal-Image-Loader" target="_blank">Android Image Loader</a></b><br />
<br />
4<b><a href="http://actionbarsherlock.com/" target="_blank">.ActionBarSherlock - ActionBar for older Android versions</a></b><br />
<br />
5.<a href="https://github.com/chrisbanes/Android-PullToRefresh" target="_blank"><b>Pull to Referesh</b></a><br />
<br />
5.<b><a href="https://github.com/excilys/androidannotations" target="_blank">Android Annotation framework</a></b><br />
<br />
6.<b><a href="https://github.com/square/Dagger" target="_blank">Dagger - dependency injection framework for java and Android</a></b><br />
<br />
7. <b><a href="https://github.com/cyrilmottier/Polaris" target="_blank">Ploaris - Google maps improvements based on API v1</a></b><br />
<br />
8<b>.</b><a href="https://github.com/jfeinstein10/SlidingMenu" target="_blank"><b>Sliding Menu implementation (1)</b> </a>or <b><a href="https://github.com/SimonVT/android-menudrawer" target="_blank">Sliding Menu implementation (2)</a></b><br />
<br />
8.<b><a href="https://github.com/JakeWharton/NineOldAndroids" target="_blank">Downport of animation framework to Android versionas of 1.6 from jake Wharton</a></b><br />
<br />
9.<a href="https://github.com/square/otto" target="_blank"><b>Otto- Event Bus for Android</b></a><br />
<br />
10.<b><a href="http://code.google.com/p/achartengine/" target="_blank">AChatEngine - Charting Engine</a></b><br />
<br />
11.<b><a href="http://ormlite.com/" target="_blank">ormLight ORM mapper</a></b><br />
<br />
12.<b><a href="http://greendao-orm.com/" target="_blank">GreeDAO from Markus junginger , ORM Mapper</a></b><br />
<br />
13<b><a href="http://code.google.com/p/roboguice/" target="_blank">.RoboGiuce for testing on the java virtual machine</a></b><br />
<br />
14. <a href="http://code.google.com/p/android-scripting/" target="_blank"><b>Android Scripting - Allows to run scripting languages on Android</b></a><br />
<br />
15.<a href="https://code.google.com/p/google-gson/" target="_blank">Google Json Parser for Android</a><br />
<br />
16.<a href="https://github.com/sromku/android-simple-facebook" target="_blank">android-simple-facebook</a><br />
<br /><br />
<br />
<br />
<div style="background-color: white; font-family: 'Droid Sans', sans-serif; line-height: 24px; margin-left: 10px; margin-right: 10px;">
<br /></div>
<br />
<br />
<br /></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2953437438691879375.post-50561089536698498542013-09-16T03:01:00.000-07:002013-09-16T03:01:09.963-07:00Android Transparency in percentage<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<br />
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline; word-wrap: break-word;">
use a color with alpha value like this <code style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 1px 5px; vertical-align: baseline;">#33------</code> and set it as background of your editText using the xml attribute <code style="background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 1px 5px; vertical-align: baseline;">android:background=" "</code></div>
<ol style="background-color: white; border: 0px; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; list-style-image: initial; list-style-position: initial; margin: 0px 0px 1em 30px; padding: 0px; vertical-align: baseline;">
<li style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;">0% (transparent) -> #00 in hex</li>
<li style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;">20% -> #33</li>
<li style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;">50% -> #80</li>
<li style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;">75% -> #C0</li>
<li style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;">100% (opaque) -> #FF</li>
</ol>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline; word-wrap: break-word;">
<strong style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">255 * 0.2 = 51 ==> in hex 33</strong></div>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline; word-wrap: break-word;">
<strong style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"><br /></strong></div>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline; word-wrap: break-word;">
<strong style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"><a href="http://stackoverflow.com/questions/11285961/how-to-make-a-background-transparent-20-in-android">http://stackoverflow.com/questions/11285961/how-to-make-a-background-transparent-20-in-android</a></strong></div>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2953437438691879375.post-43511436731900817722013-09-16T02:59:00.003-07:002013-09-16T02:59:48.616-07:00Android animation<div dir="ltr" style="text-align: left;" trbidi="on">
This page is still in construction .<br />
just collecting the various souces get to display simlpe and easy animations in android<br />
<br />
<a href="http://android-er.blogspot.in/2012/02/various-effect-of-interpolator-in.html">http://android-er.blogspot.in/2012/02/various-effect-of-interpolator-in.html</a><br />
<br /></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2953437438691879375.post-32924692149807560682013-09-12T12:00:00.003-07:002013-09-12T12:00:49.061-07:00Sms Receiver and Parser<div dir="ltr" style="text-align: left;" trbidi="on">
Android code to receive and parse a sms<br />
<br />
<a href="https://docs.google.com/file/d/0B4VB68bpH6x3MGJxZ3VIVVVablk/edit?usp=sharing" target="_blank">Click here</a> to download the sample code</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2953437438691879375.post-84143988901982670782013-09-04T12:22:00.000-07:002013-09-04T12:22:00.864-07:00Android Cron to pull data From server<div dir="ltr" style="text-align: left;" trbidi="on">
This sample app polls data from server after 10 secs<br />
<a href="https://docs.google.com/file/d/0B4VB68bpH6x3TS1yMF81N3ZJb0k/edit?usp=sharing" target="_blank">Click here</a> to download sample code</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2953437438691879375.post-33670201827517379032013-07-15T10:49:00.001-07:002013-07-15T11:29:29.141-07:00Android Google Map V2<div dir="ltr" style="text-align: left;" trbidi="on">
<a href="https://docs.google.com/file/d/0B4VB68bpH6x3VFJsbmJaRlZlOEU/edit?usp=sharing" target="_blank">Click here</a> to get the sample code to download the source code.<br />
<br />
The documentation for working with Google Map V2 is not clear documentated.<br />
For above code to work properly you need to added google play service library .<br />
<a href="http://developer.android.com/google/play-services/setup.html">http://developer.android.com/google/play-services/setup.html</a><br />
<br />
Generate the api key for android mobile at<br />
<a href="https://code.google.com/apis/console/?pli=1#project:757763940378:access">https://code.google.com/apis/console/?pli=1#project:757763940378:access</a><br />
<br />
Reference url<br />
<br />
<a href="http://iamvijayakumar.blogspot.in/2013/04/android-draw-route-between-two-geo.html">http://iamvijayakumar.blogspot.in/2013/04/android-draw-route-between-two-geo.html</a><br />
<br />
<br />
<br /></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2953437438691879375.post-74768071155952499502013-06-16T08:28:00.002-07:002013-06-16T08:28:55.151-07:00<div dir="ltr" style="text-align: left;" trbidi="on">
Android custom button with server checking animation<div>
<br /></div>
<div>
This is a <a href="https://docs.google.com/file/d/0B4VB68bpH6x3NWxTZWpiWU9MTWc/edit?usp=sharing" target="_blank">demo code</a> which polls sever after every 1 seconds and starts blinking if the repose is gretaer then 1 else stops blinking</div>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2953437438691879375.post-51282345485382729832013-06-09T09:27:00.001-07:002013-06-19T10:37:59.141-07:00Android custom gallery<div dir="ltr" style="text-align: left;" trbidi="on">
<a href="https://docs.google.com/file/d/0B4VB68bpH6x3OU8yNGlqRDkzWmM/edit?usp=sharing" target="_blank">Click here</a> to get the sample code custom android gallery with swipe gesture</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2953437438691879375.post-71011274818078528352013-05-16T09:52:00.001-07:002013-05-16T09:56:24.223-07:00Android Edit Text With Different shapes<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
The code for different edit shapes like rounded corner , oval shape etc can be created using shapes attributes<br />
<br />
The code for below can be downloaded from <a href="https://docs.google.com/file/d/0B4VB68bpH6x3RUd1RnJIRElDS28/edit?pli=1" target="_blank">here</a><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJCzMo5Kv_d_bICJ8i1t8TN6H65TPjD7Lgll_ysmP07Z-SoGXd35Qp7z3UTX6LP9gSZIaDQ8CuVzhPk2f5oAeDeaS5owoBbwIZ0fueL3HNsLAqsHEweXe2LXhXG39u_n8uCcFZGPnRGNTv/s1600/editTextShapes.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJCzMo5Kv_d_bICJ8i1t8TN6H65TPjD7Lgll_ysmP07Z-SoGXd35Qp7z3UTX6LP9gSZIaDQ8CuVzhPk2f5oAeDeaS5owoBbwIZ0fueL3HNsLAqsHEweXe2LXhXG39u_n8uCcFZGPnRGNTv/s320/editTextShapes.png" width="213" /></a></div>
<br />
<a href="http://stackoverflow.com/questions/3646415/how-to-create-edittext-with-rounded-corners">http://stackoverflow.com/questions/3646415/how-to-create-edittext-with-rounded-corners</a><br />
<br />
<a href="http://letustech.wordpress.com/category/android/">http://letustech.wordpress.com/category/android/</a><br />
<br /></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2953437438691879375.post-78127515533102868752013-05-15T19:28:00.002-07:002013-05-16T10:27:29.708-07:00Android Slide Toggle button<div dir="ltr" style="text-align: left;" trbidi="on">
By going through the following links i have created a simple demo app for iphone like slide toggle for android<br />
The code can be downloaded from <a href="https://docs.google.com/file/d/0B4VB68bpH6x3dkFlcHQyaWsyWXc/edit?usp=sharing" target="_blank">here</a><br />
<br />
<a href="http://stackoverflow.com/questions/9938315/toggle-button-in-iphone-style">http://stackoverflow.com/questions/9938315/toggle-button-in-iphone-style</a><br />
<br />
<a href="http://samir-mangroliya.blogspot.in/p/android-switch-button.html">http://samir-mangroliya.blogspot.in/p/android-switch-button.html</a><br />
<br />
<a href="http://stackoverflow.com/questions/11260218/how-to-implement-sliding-button">http://stackoverflow.com/questions/11260218/how-to-implement-sliding-button</a><br />
<br />
<a href="http://www.mokasocial.com/2011/07/sexily-styled-toggle-buttons-for-android/">http://www.mokasocial.com/2011/07/sexily-styled-toggle-buttons-for-android/</a><br />
<br />
<a href="http://stackoverflow.com/questions/8150596/android-how-to-create-slide-on-off-button">http://stackoverflow.com/questions/8150596/android-how-to-create-slide-on-off-button</a></div>
Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-2953437438691879375.post-370952780780543232013-05-15T10:44:00.003-07:002013-05-15T10:44:57.465-07:00Android Speech Buuble<div dir="ltr" style="text-align: left;" trbidi="on">
<a href="https://github.com/AdilSoomro/Android-Speech-Bubble">https://github.com/AdilSoomro/Android-Speech-Bubble</a><br />
<br />
<a href="http://developer.samsung.com/android/technical-docs/Building-a-Chat-Application">http://developer.samsung.com/android/technical-docs/Building-a-Chat-Application</a><br />
<br />
<a href="http://quickblox.com/developers/SuperSample_%28Map_Chat_code_sample%29_Android">http://quickblox.com/developers/SuperSample_%28Map_Chat_code_sample%29_Android</a><br />
<br />
<br /></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2953437438691879375.post-73053483953405610402013-05-15T10:28:00.000-07:002013-05-15T10:56:57.079-07:00Android View Pager <div dir="ltr" style="text-align: left;" trbidi="on">
Android custom view pager for disabling default switch activity<br />
<br />
<b><span style="color: red;">Step 1.</span></b><br />
<span style="color: red;">PageViewActivity.java</span><br />
<br />
<br />
<br />
import java.util.ArrayList;<br />
import java.util.List;<br />
<br />
import android.os.Bundle;<br />
import android.support.v4.app.Fragment;<br />
import android.support.v4.app.FragmentActivity;<br />
import android.support.v4.view.ViewPager.SimpleOnPageChangeListener;<br />
import android.util.Log;<br />
import android.view.View;<br />
<br />
public class PageViewActivity extends FragmentActivity {<br />
MyPageAdapter pageAdapter;<br />
int pageId=0;<br />
CustomViewPager pager;<br />
PageListener pageListener;<br />
int currentPage=0;<br />
@Override<br />
public void onCreate(Bundle savedInstanceState) {<br />
super.onCreate(savedInstanceState);<br />
setContentView(R.layout.activity_main);<br />
List<Fragment> fragments = getFragments();<br />
pageAdapter = new MyPageAdapter(getSupportFragmentManager(), fragments);<br />
pager =(CustomViewPager)findViewById(R.id.viewpager);<br />
pager.setAdapter(pageAdapter);<br />
pager.setPagingEnabled(false);<br />
<br />
pageListener = new PageListener();<br />
pager.setOnPageChangeListener(pageListener);<br />
<br />
}<br />
<br />
private List<Fragment> getFragments(){<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> List<Fragment> fList = new ArrayList<Fragment>();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> fList.add(MyFragment.newInstance("Fragment 1"));<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> fList.add(MyFragment.newInstance("Fragment 2"));<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> fList.add(MyFragment.newInstance("Fragment 3"));<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> return fList;<br />
}<br />
<br />
public void next(View v){<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if(pageId<=2)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> pager.setCurrentItem(pageId);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>pageId++;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
}<br />
<br />
private class PageListener extends SimpleOnPageChangeListener{<br />
public void onPageSelected(int position) {<br />
Log.i("test", "onPageSelected " + position);<br />
currentPage = position;<br />
}<br />
//Called when the scroll state changes.<br />
public void onPageScrollStateChanged(int state)<br />
{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
}<br />
<br />
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels)<br />
{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>Log.i("test", "onPageScrolled " + position);<br />
currentPage = position;<br />
}<br />
}<br />
<br />
<br />
}<br />
<br />
<br />
<b><span style="color: red;">Step 2.</span></b><br />
<span style="color: red;">MyPageAdapter .java</span><br />
<br />
<br />
import java.util.List;<br />
<br />
import android.support.v4.app.Fragment;<br />
import android.support.v4.app.FragmentManager;<br />
import android.support.v4.app.FragmentPagerAdapter;<br />
<br />
class MyPageAdapter extends FragmentPagerAdapter {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> private List<Fragment> fragments;<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> public MyPageAdapter(FragmentManager fm, List<Fragment> fragments) {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> super(fm);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> this.fragments = fragments;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> }<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> @Override<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> public Fragment getItem(int position) {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> return this.fragments.get(position);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> }<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> @Override<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> public int getCount() {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> return this.fragments.size();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> }<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<br />
<b><span style="color: red;">Step 3.</span></b><br />
<span style="color: red;">MyFragment.java</span><br />
<br />
<br />
import android.os.Bundle;<br />
import android.support.v4.app.Fragment;<br />
import android.view.LayoutInflater;<br />
import android.view.View;<br />
import android.view.ViewGroup;<br />
import android.widget.TextView;<br />
<br />
public class MyFragment extends Fragment {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> public static final String EXTRA_MESSAGE = "EXTRA_MESSAGE";<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> public static final MyFragment newInstance(String message)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> MyFragment f = new MyFragment();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> Bundle bdl = new Bundle(1);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> bdl.putString(EXTRA_MESSAGE, message);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> f.setArguments(bdl);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> return f;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> }<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> @Override<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> public View onCreateView(LayoutInflater inflater, ViewGroup container,<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> Bundle savedInstanceState) {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> String message = getArguments().getString(EXTRA_MESSAGE);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> View v = inflater.inflate(R.layout.myfragment_layout, container, false);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> TextView messageTextView = (TextView)v.findViewById(R.id.textView);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> messageTextView.setText(message);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> return v;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> }<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span style="color: red;"><br /></span>
<b><span style="color: red;">Step 4.</span></b><br />
<span style="color: red;">CustomViewPager.java</span><br />
<br />
<br />
import android.content.Context;<br />
import android.util.AttributeSet;<br />
import android.view.MotionEvent;<br />
<br />
public class CustomViewPager extends android.support.v4.view.ViewPager {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>private boolean enabled;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public CustomViewPager(Context context, AttributeSet attrs) {<br />
super(context, attrs);<br />
this.enabled = true;<br />
}<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> @Override<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> public boolean onTouchEvent(MotionEvent event) {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> if (this.enabled) {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> return super.onTouchEvent(event);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> }<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> return false;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> }<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> @Override<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> public boolean onInterceptTouchEvent(MotionEvent event) {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> if (this.enabled) {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> return super.onInterceptTouchEvent(event);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> }<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> return false;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> }<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> /**<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> * Custom implementation to enable or not swipe :)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> *<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> * @param enabled<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> * true to enable swipe, false otherwise.<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> */<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> public void setPagingEnabled(boolean enabled) {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> this.enabled = enabled;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> }<br />
<br />
}<br />
<br />
<b><span style="color: red;">Step 5.</span></b><br />
<span style="color: red;">activity_main.xml</span><br />
<br />
<br />
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"<br />
xmlns:tools="http://schemas.android.com/tools"<br />
android:layout_width="match_parent"<br />
android:layout_height="match_parent" ><br />
<br />
<com.example.viewpagerdemo.CustomViewPager<br />
android:id="@+id/viewpager"<br />
android:layout_width="fill_parent"<br />
android:layout_height="fill_parent" /><br />
<br />
</RelativeLayout><br />
<br />
<b><span style="color: red;">Step 6.</span></b><br />
<span style="color: red;">myfragment_layout.xml</span><br />
<span style="color: red;"><br /></span>
<br />
<?xml version="1.0" encoding="utf-8"?><br />
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"<br />
android:layout_width="match_parent"<br />
android:layout_height="match_parent"<br />
android:orientation="vertical" ><br />
<TextView<br />
android:id="@+id/textView"<br />
android:layout_width="wrap_content"<br />
android:layout_height="wrap_content"<br />
android:layout_centerHorizontal="true"<br />
android:layout_centerVertical="true"<br />
/><br />
<Button<br />
android:layout_width="wrap_content"<br />
android:layout_height="wrap_content"<br />
android:text="Next"<br />
android:onClick="next"<br />
/><br />
<br />
</RelativeLayout><br />
<br />
<a href="http://architects.dzone.com/articles/android-tutorial-using">http://architects.dzone.com/articles/android-tutorial-using</a><br />
<a href="http://blog.evoxmusic.fr/content/android-how-disable-viewpager-page-switch">http://blog.evoxmusic.fr/content/android-how-disable-viewpager-page-switch</a><br />
<br /></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2953437438691879375.post-73070434622063286552013-05-15T09:42:00.001-07:002013-05-15T10:42:18.948-07:00Android GSON parsing<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<span style="background-color: white; color: #555555; font-family: Arial; font-size: 12px; line-height: 18px;">Step 1.</span><br />
<span style="background-color: white; color: #555555; font-family: Arial; font-size: 12px; line-height: 18px;">Download the Gson library from </span><a href="http://code.google.com/p/google-gson/" style="-webkit-transition: color 200ms ease-in; background-color: white; border: 0px; color: #3086e1; font-family: Arial; font-size: 12px; line-height: 18px; margin: 0px; padding: 0px; text-decoration: none; transition: color 200ms ease-in; vertical-align: baseline;">http://code.google.com/p/google-gson/</a><span style="background-color: white; color: #555555; font-family: Arial; font-size: 12px; line-height: 18px;"> and add it to your java build path in eclipse.</span><br />
<span style="background-color: white; color: #555555; font-family: Arial; font-size: 12px; line-height: 18px;"><br /></span>
<span style="background-color: white; color: #555555; font-family: Arial; font-size: 12px; line-height: 18px;">Step 2.</span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;">Create a php file and paste the following json data into it</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"><br /></span></span>
<span style="background-color: white; font-family: Monaco, 'Lucida Console', monospace; font-size: 13px; line-height: 18.1875px; white-space: nowrap;">{"as_of":"Thu, 25 Feb 2010 11:30:17 +0000","trends"</span><br />
<span style="background-color: white; font-family: Monaco, 'Lucida Console', monospace; font-size: 13px; line-height: 18.1875px; white-space: nowrap;">:[{"name":"#nowplaying",</span><br />
<span style="background-color: white; font-family: Monaco, 'Lucida Console', monospace; font-size: 13px; line-height: 18.1875px; white-space: nowrap;">"url":"http://search.twitter.com/search?q=%23nowplaying"}</span><br />
<span style="background-color: white; font-family: Monaco, 'Lucida Console', monospace; font-size: 13px; line-height: 18.1875px; white-space: nowrap;">,{"name":"#nothingworsethan",</span><br />
<span style="background-color: white; font-family: Monaco, 'Lucida Console', monospace; font-size: 13px; line-height: 18.1875px; white-space: nowrap;">"url":"http://search.twitter.com/search?q=%23nothingworsethan"},</span><br />
<span style="background-color: white; font-family: Monaco, 'Lucida Console', monospace; font-size: 13px; line-height: 18.1875px; white-space: nowrap;">{"name":"Dubai Mall",</span><br />
<span style="background-color: white; font-family: Monaco, 'Lucida Console', monospace; font-size: 13px; line-height: 18.1875px; white-space: nowrap;">"url":"http://search.twitter.com/search?q=%22Dubai+Mall%22"},</span><br />
<span style="background-color: white; font-family: Monaco, 'Lucida Console', monospace; font-size: 13px; line-height: 18.1875px; white-space: nowrap;">{"name":"iPad Gets",</span><br />
<span style="background-color: white; font-family: Monaco, 'Lucida Console', monospace; font-size: 13px; line-height: 18.1875px; white-space: nowrap;">"url":"http://search.twitter.com/search?q=%22iPad+Gets%22"},</span><br />
<span style="background-color: white; font-family: Monaco, 'Lucida Console', monospace; font-size: 13px; line-height: 18.1875px; white-space: nowrap;">{"name":"#SuperJuniorTrot",</span><br />
<span style="background-color: white; font-family: Monaco, 'Lucida Console', monospace; font-size: 13px; line-height: 18.1875px; white-space: nowrap;">"url":"http://search.twitter.com/search?q=%23SuperJuniorTrot"},</span><br />
<span style="background-color: white; font-family: Monaco, 'Lucida Console', monospace; font-size: 13px; line-height: 18.1875px; white-space: nowrap;">{"name":"Justin Bieber",</span><br />
<span style="background-color: white; font-family: Monaco, 'Lucida Console', monospace; font-size: 13px; line-height: 18.1875px; white-space: nowrap;">"url":"http://search.twitter.com/search?q=%22Justin+Bieber%22"},</span><br />
<span style="background-color: white; font-family: Monaco, 'Lucida Console', monospace; font-size: 13px; line-height: 18.1875px; white-space: nowrap;">{"name":"Click",</span><br />
<span style="background-color: white; font-family: Monaco, 'Lucida Console', monospace; font-size: 13px; line-height: 18.1875px; white-space: nowrap;">"url":"http://search.twitter.com/search?q=Click"},</span><br />
<span style="background-color: white; font-family: Monaco, 'Lucida Console', monospace; font-size: 13px; line-height: 18.1875px; white-space: nowrap;">{"name":"Jaebum",</span><br />
<span style="background-color: white; font-family: Monaco, 'Lucida Console', monospace; font-size: 13px; line-height: 18.1875px; white-space: nowrap;">"url":"http://search.twitter.com/search?q=Jaebum"},</span><br />
<span style="background-color: white; font-family: Monaco, 'Lucida Console', monospace; font-size: 13px; line-height: 18.1875px; white-space: nowrap;">{"name":"#tosavemoney",</span><br />
<span style="background-color: white; font-family: Monaco, 'Lucida Console', monospace; font-size: 13px; line-height: 18.1875px; white-space: nowrap;">"url":"http://search.twitter.com/search?q=%23tosavemoney"},</span><br />
<span style="background-color: white; font-family: Monaco, 'Lucida Console', monospace; font-size: 13px; line-height: 18.1875px; white-space: nowrap;">{"name":"Protection",</span><br />
<span style="background-color: white; font-family: Monaco, 'Lucida Console', monospace; font-size: 13px; line-height: 18.1875px; white-space: nowrap;">"url":"http://search.twitter.com/search?q=Protection"}]}</span><br />
<span style="background-color: white; font-family: Monaco, 'Lucida Console', monospace; font-size: 13px; line-height: 18.1875px; white-space: nowrap;"><br /></span>
<span style="background-color: white; color: #555555; font-family: Arial; font-size: 12px; line-height: 18px;">Step 3.</span><br />
<span style="background-color: white; color: #555555; font-family: Arial; font-size: 12px; line-height: 18px;">Create the following two classes to hold the information of the json data</span><br />
<span style="background-color: white; color: #555555; font-family: Arial; font-size: 12px; line-height: 18px;"><br /></span>
<span style="background-color: white; color: #555555; font-family: Arial; font-size: 12px; line-height: 18px;">TwitterTrend .java</span><br />
<span style="background-color: white;"><span style="color: #555555; font-family: Arial;"></span></span><br />
<div style="font-size: 12px; line-height: 18px;">
<span style="color: #555555; font-family: Arial;">public class TwitterTrend {</span></div>
<div style="font-size: 12px; line-height: 18px;">
<span style="color: #555555; font-family: Arial;"> public String name;</span></div>
<div style="font-size: 12px; line-height: 18px;">
<span style="color: #555555; font-family: Arial;"> public String url;</span></div>
<div style="font-size: 12px; line-height: 18px;">
<span style="color: #555555; font-family: Arial;">}</span></div>
<div style="font-size: 12px; line-height: 18px;">
<span style="color: #555555; font-family: Arial;"><br /></span></div>
<div style="font-size: 12px; line-height: 18px;">
<span style="color: #555555; font-family: Arial;">TwitterTrends .java</span></div>
<br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;">public class TwitterTrends {</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"><br /></span></span>
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> public String as_of;</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> public List<TwitterTrend> trends;</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> </span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> public String getAs_Of() {</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> return as_of;</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> }</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> public void setAs_Of(String asOf) {</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> as_of = asOf;</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> }</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> public List<TwitterTrend> getTrends() {</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> return trends;</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> }</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> public void setTrends(List<TwitterTrend> trends) {</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> this.trends = trends;</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> }</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> </span><span style="font-size: 12px; line-height: 18px;"> </span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;">}</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"><br /></span></span>
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;">Step 4. create the main activity </span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;">MainActivity.java</span></span><br />
<br />
<br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;">public class MainActivity extends Activity {</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"><br /></span></span>
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>@Override</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>protected void onCreate(Bundle savedInstanceState) {</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>super.onCreate(savedInstanceState);</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>setContentView(R.layout.activity_main);</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>runJSONParser();</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"><br /></span></span>
<span style="color: #555555; font-family: Arial;"><span class="Apple-tab-span" style="font-size: 12px; line-height: 18px; white-space: pre;"> </span></span><br />
<span style="color: #555555; font-family: Arial;"><span class="Apple-tab-span" style="font-size: 12px; line-height: 18px; white-space: pre;"> </span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public InputStream getJSONData(String url){</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> DefaultHttpClient httpClient = new DefaultHttpClient();</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> URI uri;</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> InputStream data = null;</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> try {</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> uri = new URI(url);</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> HttpGet method = new HttpGet(uri);</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> HttpResponse response = httpClient.execute(method);</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> data = response.getEntity().getContent();</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> } catch (Exception e) {</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> e.printStackTrace();</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> }</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> </span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> return data;</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> }</span></span><br />
<span style="color: #555555; font-family: Arial;"><span class="Apple-tab-span" style="font-size: 12px; line-height: 18px; white-space: pre;"> </span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public void runJSONParser(){</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> try{</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> Log.i("MY INFO", "Json Parser started..");</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> Gson gson = new Gson();</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> Reader r = new InputStreamReader(getJSONData("http://10.0.2.2/gsonTest/index.php"));</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> Log.e("MY INFO", r.toString());</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> TwitterTrends objs = gson.fromJson(r, TwitterTrends.class);</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> Log.e("MY INFO", ""+objs.getTrends().size());</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> for(TwitterTrend tr : objs.getTrends()){</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> Log.e("TRENDS", tr.name + " - " + tr.url);</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> }</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> }catch(Exception ex){</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> ex.printStackTrace();</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> }</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> }</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"><br /></span></span>
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;">}</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"><br /></span></span>
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;">step 5.</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;">Add the following lines into the xml file</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"> <uses-permission android:name="android.permission.INTERNET" /> </span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"><br /></span></span>
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;">Step 6.</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;">run the app , u will see the following log</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"><br /></span></span>
<br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;">05-15 22:01:54.623: I/MY INFO(1796): Json Parser started..</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;">05-15 22:01:54.733: E/MY INFO(1796): java.io.InputStreamReader@43e55058</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;">05-15 22:01:54.773: E/MY INFO(1796): 10</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;">05-15 22:01:54.773: E/TRENDS(1796): #nowplaying - http://search.twitter.com/search?q=%23nowplaying</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;">05-15 22:01:54.773: E/TRENDS(1796): #nothingworsethan - http://search.twitter.com/search?q=%23nothingworsethan</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;">05-15 22:01:54.773: E/TRENDS(1796): Dubai Mall - http://search.twitter.com/search?q=%22Dubai+Mall%22</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;">05-15 22:01:54.773: E/TRENDS(1796): iPad Gets - http://search.twitter.com/search?q=%22iPad+Gets%22</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;">05-15 22:01:54.773: E/TRENDS(1796): #SuperJuniorTrot - http://search.twitter.com/search?q=%23SuperJuniorTrot</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;">05-15 22:01:54.773: E/TRENDS(1796): Justin Bieber - http://search.twitter.com/search?q=%22Justin+Bieber%22</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;">05-15 22:01:54.773: E/TRENDS(1796): Click - http://search.twitter.com/search?q=Click</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;">05-15 22:01:54.773: E/TRENDS(1796): Jaebum - http://search.twitter.com/search?q=Jaebum</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;">05-15 22:01:54.773: E/TRENDS(1796): #tosavemoney - http://search.twitter.com/search?q=%23tosavemoney</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;">05-15 22:01:54.773: E/TRENDS(1796): Protection - http://search.twitter.com/search?q=Protection</span></span><br />
<span style="color: #555555; font-family: Arial;"><span style="font-size: 12px; line-height: 18px;"><br /></span></span>
<a href="http://www.softwarepassion.com/android-series-parsing-json-data-with-gson/">http://www.softwarepassion.com/android-series-parsing-json-data-with-gson/</a><br />
<br /></div>
Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-2953437438691879375.post-62075295661833036222013-05-12T11:02:00.002-07:002013-05-12T11:02:57.739-07:00Send Xml Data From Android to PHP server<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
package com.example.sendxmltest;<br />
<br />
import java.io.IOException;<br />
<br />
import org.apache.http.HttpEntity;<br />
import org.apache.http.HttpResponse;<br />
import org.apache.http.client.ClientProtocolException;<br />
import org.apache.http.client.HttpClient;<br />
import org.apache.http.client.methods.HttpPost;<br />
import org.apache.http.entity.StringEntity;<br />
import org.apache.http.impl.client.DefaultHttpClient;<br />
import org.apache.http.protocol.HTTP;<br />
import org.apache.http.util.EntityUtils;<br />
<br />
import android.app.Activity;<br />
import android.os.Bundle;<br />
import android.util.Log;<br />
import android.view.Menu;<br />
<br />
public class MainActivity extends Activity {<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>@Override<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>protected void onCreate(Bundle savedInstanceState) {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>super.onCreate(savedInstanceState);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>setContentView(R.layout.activity_main);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>HttpClient httpclient = new DefaultHttpClient();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> HttpPost httppost = new HttpPost("http://10.0.2.2/server_log/index.php");<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> try {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> StringEntity se = new StringEntity( "<aaaLogin inName=\"admin\" inPassword=\"admin123\"/>", HTTP.UTF_8);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> se.setContentType("text/xml");<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> httppost.setEntity(se);<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> HttpResponse httpresponse = httpclient.execute(httppost);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> HttpEntity resEntity = httpresponse.getEntity();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> Log.e("test",EntityUtils.toString(resEntity));<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> //tvData.setText(EntityUtils.toString(resEntity));<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> } catch (ClientProtocolException e) {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> // TODO Auto-generated catch block<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>Log.e("test",e.getMessage());<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> e.printStackTrace();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> } catch (IOException e) {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> // TODO Auto-generated catch block<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>Log.e("test",e.getMessage());<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>e.printStackTrace();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> }<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>@Override<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public boolean onCreateOptionsMenu(Menu menu) {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>// Inflate the menu; this adds items to the action bar if it is present.<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>getMenuInflater().inflate(R.menu.main, menu);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>return true;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<br />
}<br />
<div>
<br /></div>
<div>
<br /></div>
<div>
PHP code to receive xml data </div>
<div>
<br /></div>
<div>
<div>
<?php</div>
<div>
/*</div>
<div>
* XML Server.</div>
<div>
*/</div>
<div>
// We use php://input to get the raw $_POST results.</div>
<div>
$xml_post = file_get_contents('php://input');</div>
<div>
// If we receive data, save it.</div>
<div>
if ($xml_post) {</div>
<div>
$xml_file = 'received_xml_' . date('Y_m_d-H-i-s') . '.xml';</div>
<div>
$fh = fopen($xml_file, 'w') or die();</div>
<div>
fwrite($fh, $xml_post);</div>
<div>
fclose($fh);</div>
<div>
// Return, as we don't want to cause a loop by processing the code below.</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>echo "data xml --".$xml_post;</div>
<div>
}</div>
<div>
// print_r($_SERVER);</div>
<div>
</div>
<div>
return;</div>
<div>
?></div>
</div>
<div>
<br /></div>
<div>
<br /></div>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2953437438691879375.post-165586422562553442013-05-04T01:53:00.004-07:002013-05-04T01:53:55.288-07:00Android CutomArrayAdapter with CheckBox<div dir="ltr" style="text-align: left;" trbidi="on">
Contact.java<br />
<br />
<br />
package com.example.testandroid;<br />
<br />
public class Contact {<br />
public String name;<br />
public String phone;<br />
public Boolean selected;<br />
public Contact()<br />
{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
}<br />
public Contact(String name,String phone){<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>this.name=name;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>this.phone=phone;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>this.selected=false;<br />
}<br />
}<br />
<br />
ContactsAdapter.java<br />
<br />
<br />
package com.example.testandroid;<br />
<br />
import java.util.ArrayList;<br />
<br />
import android.app.Activity;<br />
import android.content.Context;<br />
import android.view.LayoutInflater;<br />
import android.view.View;<br />
import android.view.ViewGroup;<br />
import android.widget.ArrayAdapter;<br />
import android.widget.CheckBox;<br />
import android.widget.TextView;<br />
import android.widget.Toast;<br />
<br />
public class ContactsAdapter extends ArrayAdapter<Contact>{<br />
<br />
Context context;<br />
int layoutResourceId,temp; <br />
ArrayList<Contact> data;<br />
<br />
public ContactsAdapter(Context context, int layoutResourceId, ArrayList<Contact> data) {<br />
super(context, layoutResourceId, data);<br />
this.layoutResourceId = layoutResourceId;<br />
this.context = context;<br />
this.data = data;<br />
}<br />
<br />
@Override<br />
public View getView(int position, View convertView, ViewGroup parent) {<br />
View row = convertView;<br />
ContactHolder holder = null;<br />
Contact contact = data.get(position);<br />
final int pos=position;<br />
temp=position;<br />
if(row == null)<br />
{<br />
LayoutInflater inflater = ((Activity)context).getLayoutInflater();<br />
row = inflater.inflate(layoutResourceId, parent, false);<br />
<br />
holder = new ContactHolder();<br />
holder.name = (TextView)row.findViewById(R.id.name);<br />
holder.phone = (TextView)row.findViewById(R.id.mobile);<br />
holder.chkBox = (CheckBox)row.findViewById(R.id.chk_sel);<br />
holder.chkBox.setOnClickListener( new View.OnClickListener() { <br />
public void onClick(View v) { <br />
CheckBox cb = (CheckBox) v ; <br />
//Contact contact = (Contact) cb.getTag(); <br />
Toast.makeText(context,"Clicked on Checkbox: " + data.get(pos).name +" is " + cb.isChecked(),Toast.LENGTH_LONG).show();<br />
data.get(pos).selected=cb.isChecked();<br />
} <br />
}); <br />
row.setTag(holder);<br />
}<br />
else<br />
{<br />
holder = (ContactHolder)row.getTag();<br />
}<br />
<br />
<br />
holder.name.setText(contact.name);<br />
holder.phone.setText(contact.phone);<br />
<br />
return row;<br />
}<br />
<br />
static class ContactHolder<br />
{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>TextView name;<br />
TextView phone;<br />
CheckBox chkBox;<br />
}<br />
}<br />
<br />
MainActivity.java<br />
<br />
<br />
package com.example.testandroid;<br />
<br />
import java.util.ArrayList;<br />
import java.util.ListIterator;<br />
<br />
import android.app.Activity;<br />
import android.app.AlertDialog;<br />
import android.app.Dialog;<br />
import android.content.DialogInterface;<br />
import android.os.Bundle;<br />
import android.util.Log;<br />
import android.view.LayoutInflater;<br />
import android.view.Menu;<br />
import android.view.MenuInflater;<br />
import android.view.MenuItem;<br />
import android.view.View;<br />
import android.widget.EditText;<br />
import android.widget.ListView;<br />
import android.widget.Toast;<br />
<br />
public class MainActivity extends Activity {<br />
ArrayList<Contact> mContacts;<br />
ListView listView1;<br />
ContactsAdapter adapter;<br />
String mAction;<br />
ListIterator<Contact> litr ;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>@Override<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>protected void onCreate(Bundle savedInstanceState) {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>super.onCreate(savedInstanceState);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>setContentView(R.layout.activity_main);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>mContacts=new ArrayList<Contact>();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>for(int i=0;i<10;i++)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>Contact c=new Contact("name"+i,"9748544"+i);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>mContacts.add(c);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>adapter = new ContactsAdapter(this,R.layout.container, mContacts);<br />
<br />
listView1 = (ListView)findViewById(R.id.lisstview);<br />
<br />
listView1.setAdapter(adapter);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>// Initiating Menu XML file (menu.xml)<br />
@Override<br />
public boolean onCreateOptionsMenu(Menu menu)<br />
{<br />
MenuInflater menuInflater = getMenuInflater();<br />
menuInflater.inflate(R.layout.menu, menu);<br />
return true;<br />
}<br />
<br />
public void add_edit_dialog(String title,String action){<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>mAction=action;<br />
LayoutInflater factory = LayoutInflater.from(this);<br />
final View textEntryView = factory.inflate(R.layout.add_edit_dialog, null);<br />
Dialog d= new AlertDialog.Builder(MainActivity.this)<br />
.setTitle(title)<br />
.setView(textEntryView)<br />
.setPositiveButton("Ok", new DialogInterface.OnClickListener() {<br />
public void onClick(DialogInterface dialog, int whichButton) {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>String name,phoneno;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>EditText et_name,et_phone;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>et_name=(EditText)textEntryView.findViewById(R.id.name_edit);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>et_phone=(EditText)textEntryView.findViewById(R.id.mobile_edit);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>name=et_name.getText().toString();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>phoneno=et_phone.getText().toString();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if(mAction.equals("add"))<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>Contact c=new Contact(name,phoneno);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>mContacts.add(c);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> listView1.setAdapter(adapter);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>adapter.notifyDataSetChanged();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>else if(mAction.equals("edit"))<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>Toast.makeText(getApplicationContext(), "mae="+name, Toast.LENGTH_LONG).show();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>litr = mContacts.listIterator();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>while (litr.hasNext()) {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>Contact element = litr.next();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> if(element.selected==true)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>element.name=name;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>element.phone=phoneno;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>Log.e("test","name is "+element.name);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> listView1.setAdapter(adapter);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>adapter.notifyDataSetChanged();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
/* User clicked OK so do some stuff */<br />
}<br />
})<br />
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {<br />
public void onClick(DialogInterface dialog, int whichButton) {<br />
<br />
/* User clicked cancel so do some stuff */<br />
}<br />
})<br />
.create();<br />
d.show();<br />
}<br />
<br />
/**<br />
* Event Handling for Individual menu item selected<br />
* Identify single menu item by it's id<br />
* */<br />
@Override<br />
public boolean onOptionsItemSelected(MenuItem item)<br />
{<br />
<br />
switch (item.getItemId())<br />
{<br />
case R.id.menu_add:<br />
// Single menu item is selected do something<br />
// Ex: launching new activity/screen or show alert message<br />
Toast.makeText(MainActivity.this, "Add is Selected", Toast.LENGTH_SHORT).show();<br />
add_edit_dialog("Add Contact","add");<br />
return true;<br />
<br />
case R.id.menu_edit:<br />
Toast.makeText(MainActivity.this, "Edit is Selected", Toast.LENGTH_SHORT).show();<br />
add_edit_dialog("Edit Contact","edit");<br />
return true;<br />
<br />
case R.id.menu_del:<br />
Toast.makeText(MainActivity.this, "del is Selected", Toast.LENGTH_SHORT).show();<br />
litr = mContacts.listIterator();<br />
while (litr.hasNext()) {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> Contact element = litr.next();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> if(element.selected==true)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>litr.remove();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<br />
}<br />
/* for(int i=0;i<mContacts.size();i++)<br />
{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if(mContacts.get(i).selected==true)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>mContacts.remove(i);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
}*/<br />
listView1.setAdapter(adapter);<br />
adapter.notifyDataSetChanged();<br />
return true;<br />
<br />
default:<br />
return super.onOptionsItemSelected(item);<br />
}<br />
} <br />
<br />
}<br />
<div>
<br /></div>
<div>
<br /></div>
<div>
activity_main.xml</div>
<div>
<br /></div>
<div>
<div>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"</div>
<div>
xmlns:tools="http://schemas.android.com/tools"</div>
<div>
android:layout_width="match_parent"</div>
<div>
android:layout_height="match_parent"</div>
<div>
android:paddingBottom="@dimen/activity_vertical_margin"</div>
<div>
android:paddingLeft="@dimen/activity_horizontal_margin"</div>
<div>
android:paddingRight="@dimen/activity_horizontal_margin"</div>
<div>
android:paddingTop="@dimen/activity_vertical_margin"</div>
<div>
tools:context=".MainActivity" ></div>
<div>
<br /></div>
<div>
<ListView</div>
<div>
android:id="@+id/lisstview"</div>
<div>
android:layout_width="fill_parent"</div>
<div>
android:layout_height="fill_parent"</div>
<div>
/></div>
<div>
<br /></div>
<div>
</RelativeLayout></div>
</div>
<div>
<br /></div>
<div>
add_edit_dialog.xml</div>
<div>
<br /></div>
<div>
<div>
<?xml version="1.0" encoding="utf-8"?></div>
<div>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"</div>
<div>
android:layout_width="match_parent"</div>
<div>
android:layout_height="wrap_content"</div>
<div>
android:orientation="vertical"></div>
<div>
<br /></div>
<div>
<TextView </div>
<div>
android:id="@+id/name_view"</div>
<div>
android:layout_height="wrap_content"</div>
<div>
android:layout_width="wrap_content"</div>
<div>
android:layout_marginLeft="20dip"</div>
<div>
android:layout_marginRight="20dip"</div>
<div>
android:text="Name"</div>
<div>
android:gravity="left"</div>
<div>
android:textAppearance="?android:attr/textAppearanceMedium" /></div>
<div>
</div>
<div>
<EditText</div>
<div>
android:id="@+id/name_edit"</div>
<div>
android:layout_height="wrap_content"</div>
<div>
android:layout_width="match_parent"</div>
<div>
android:layout_marginLeft="20dip"</div>
<div>
android:layout_marginRight="20dip"</div>
<div>
android:scrollHorizontally="true"</div>
<div>
android:autoText="false"</div>
<div>
android:capitalize="none"</div>
<div>
android:gravity="fill_horizontal"</div>
<div>
android:textAppearance="?android:attr/textAppearanceMedium" /></div>
<div>
<br /></div>
<div>
<TextView</div>
<div>
android:id="@+id/mobile_view"</div>
<div>
android:layout_height="wrap_content"</div>
<div>
android:layout_width="wrap_content"</div>
<div>
android:layout_marginLeft="20dip"</div>
<div>
android:layout_marginRight="20dip"</div>
<div>
android:text="Mobile no"</div>
<div>
android:gravity="left"</div>
<div>
android:textAppearance="?android:attr/textAppearanceMedium" /></div>
<div>
</div>
<div>
<EditText</div>
<div>
android:id="@+id/mobile_edit"</div>
<div>
android:layout_height="wrap_content"</div>
<div>
android:layout_width="match_parent"</div>
<div>
android:layout_marginLeft="20dip"</div>
<div>
android:layout_marginRight="20dip"</div>
<div>
android:scrollHorizontally="true"</div>
<div>
android:autoText="false"</div>
<div>
android:capitalize="none"</div>
<div>
android:gravity="fill_horizontal"</div>
<div>
android:password="true"</div>
<div>
android:textAppearance="?android:attr/textAppearanceMedium" /></div>
<div>
</div>
<div>
</LinearLayout></div>
</div>
<div>
<br /></div>
<div>
container.xml</div>
<div>
<br /></div>
<div>
<div>
<?xml version="1.0" encoding="utf-8"?></div>
<div>
<LinearLayout</div>
<div>
xmlns:android="http://schemas.android.com/apk/res/android"</div>
<div>
android:layout_width="match_parent"</div>
<div>
android:weightSum="4"</div>
<div>
android:layout_height="match_parent"></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span><LinearLayout</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span> android:layout_height="wrap_content"</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span> android:layout_width="0dp"</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span> android:orientation="vertical"</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span> android:layout_weight="3"></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span> <TextView</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span> android:id="@+id/name"</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span> android:text="Name"</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span> android:layout_width="match_parent"</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span> android:layout_height="wrap_content"></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span> </TextView></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span> <TextView</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span> android:paddingLeft="10dp"</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span> android:id="@+id/mobile"</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span> android:text="Mobile"</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span> android:layout_width="match_parent"</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span> android:layout_height="wrap_content"></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span> </TextView></div>
<div>
</LinearLayout></div>
<div>
<LinearLayout</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span> android:layout_height="wrap_content"</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span> android:layout_width="0dp"</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span> android:gravity="center"</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span> android:layout_weight="1"></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span> <CheckBox</div>
<div>
android:id="@+id/chk_sel"</div>
<div>
android:layout_width="wrap_content"</div>
<div>
android:layout_height="wrap_content"</div>
<div>
/></div>
<div>
</LinearLayout></div>
<div>
<br /></div>
<div>
</div>
<div>
<br /></div>
<div>
</LinearLayout></div>
</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
menu.xml</div>
<div>
<br /></div>
<div>
<div>
<?xml version="1.0" encoding="utf-8"?></div>
<div>
<menu xmlns:android="http://schemas.android.com/apk/res/android"></div>
<div>
<item android:id="@+id/menu_add"</div>
<div>
android:title="Add" /></div>
<div>
</div>
<div>
<item android:id="@+id/menu_del"</div>
<div>
android:title="Delete" /></div>
<div>
</div>
<div>
<item android:id="@+id/menu_edit"</div>
<div>
android:title="Edit" /></div>
<div>
</div>
<div>
</menu></div>
</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<br />
<br />
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2953437438691879375.post-49640280303882646442013-03-29T09:21:00.000-07:002013-03-29T09:21:34.275-07:00XmlPullParsers sample Code<div dir="ltr" style="text-align: left;" trbidi="on">
Book.java<br />
<br />
<br />
package com.eaxmple.xmlpullparser.classess;<br />
<br />
public class Book {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public String bookId;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public String author;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public String title;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public String genre;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public String publish_date;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public String desc;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public double price;<br />
}<br />
<br />
<br />
<b>BookParser.java</b><br />
<b><br /></b>
<br />
package com.eaxmple.xmlpullparser.parsers;<br />
<br />
import java.io.InputStream;<br />
import java.util.ArrayList;<br />
import java.util.HashMap;<br />
import java.util.List;<br />
import java.util.Map;<br />
<br />
import org.xmlpull.v1.XmlPullParser;<br />
import org.xmlpull.v1.XmlPullParserFactory;<br />
<br />
import android.content.Context;<br />
import android.util.Log;<br />
<br />
import com.eaxmple.xmlpullparser.classess.Book;<br />
<br />
public class BookParser {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>List<Book> mBooksList;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>String mXmlFilePath;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>Context mContext;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>XmlPullParser xpp;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>Book tempBook;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public BookParser(Context context,String filePath){<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>mBooksList=new ArrayList<Book>();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>mContext=context;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>mXmlFilePath=filePath;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public List<Book> parse() throws Exception{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>InputStream istr = mContext.getAssets().open(mXmlFilePath);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>XmlPullParserFactory factory = XmlPullParserFactory.newInstance();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>factory.setNamespaceAware(true);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>xpp = factory.newPullParser();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>xpp.setInput(istr, "UTF-8");<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>int eventType = xpp.getEventType();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
while (eventType != XmlPullParser.END_DOCUMENT)<br />
{<br />
if(eventType == XmlPullParser.START_TAG)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> <br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> String startTag=xpp.getName(); <br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if(startTag.equals("book"))<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>tempBook=new Book();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>Map<String,String> attributes = getAttributes(xpp);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>tempBook.bookId=attributes.get("id");<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>else if(startTag.equals("author"))<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>tempBook.author=xpp.nextText();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>else if(startTag.equals("title"))<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>tempBook.title=xpp.nextText();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>else if(startTag.equals("genre"))<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>tempBook.genre=xpp.nextText();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>else if(startTag.equals("price"))<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>tempBook.price=Double.parseDouble(xpp.nextText());<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>else if(startTag.equals("publish_date"))<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>tempBook.publish_date=xpp.nextText();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>else if(startTag.equals("description"))<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>tempBook.desc=xpp.nextText();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>else if(eventType == XmlPullParser.END_TAG)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>String endTag=xpp.getName();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("End Tag "+endTag);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if(endTag.equals("book"))<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>mBooksList.add(tempBook);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>eventType = xpp.next();<br />
}<br />
return mBooksList;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>private Map<String,String> getAttributes(XmlPullParser parser) throws Exception {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> Map<String,String> attrs=null;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> int acount=parser.getAttributeCount();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> if(acount != -1) {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> attrs = new HashMap<String,String>(acount);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> for(int x=0;x<acount;x++) {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> attrs.put(parser.getAttributeName(x), parser.getAttributeValue(x));<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> }<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> }<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> else {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> throw new Exception("Required entity attributes missing");<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> }<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> return attrs;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<br />
}<br />
<div style="font-weight: bold;">
<br /></div>
<div style="font-weight: bold;">
MainActivity.java</div>
<div style="font-weight: bold;">
<br /></div>
<div>
<div>
package com.example.xmlpullparser;</div>
<div>
<br /></div>
<div>
import java.util.ArrayList;</div>
<div>
<br /></div>
<div>
import android.app.Activity;</div>
<div>
import android.os.Bundle;</div>
<div>
import android.util.Log;</div>
<div>
import android.widget.Toast;</div>
<div>
<br /></div>
<div>
import com.eaxmple.xmlpullparser.classess.Book;</div>
<div>
import com.eaxmple.xmlpullparser.parsers.BookParser;</div>
<div>
<br /></div>
<div>
public class MainActivity extends Activity {</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>ArrayList<Book> books;</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>@Override</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>protected void onCreate(Bundle savedInstanceState) {</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>super.onCreate(savedInstanceState);</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>setContentView(R.layout.activity_main);</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>BookParser bookParser=new BookParser(this,"xml/books.xml");</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>try {</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span> books=(ArrayList<Book>) bookParser.parse();</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span> System.out.println(books.size());</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span> Toast.makeText(getApplicationContext(), "count is"+books.size(), Toast.LENGTH_LONG).show();</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span> for(int i=0;i<books.size()-1;i++)</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span> {</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>Log.e("xmlPullparser","book id="+books.get(i).bookId+" book name="+books.get(i).title);</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span> }</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>} catch (Exception e) {</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>// TODO Auto-generated catch block</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>e.printStackTrace();</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div>
<br /></div>
<div>
}</div>
<div style="font-weight: bold;">
<br /></div>
</div>
<div style="font-weight: bold;">
Assest/xml/books.xml</div>
<div style="font-weight: bold;">
<br /></div>
<div>
<div>
<b><?xml version="1.0"?></b></div>
<div>
<b><catalog></b></div>
<div>
<b> <book id="bk101"></b></div>
<div>
<b> <author>Gambardella, Matthew</author></b></div>
<div>
<b> <title>XML Developer's Guide</title></b></div>
<div>
<b> <genre>Computer</genre></b></div>
<div>
<b> <price>44.95</price></b></div>
<div>
<b> <publish_date>2000-10-01</publish_date></b></div>
<div>
<b> <description>An in-depth look at creating applications </b></div>
<div>
<b> with XML.</description></b></div>
<div>
<b> </book></b></div>
<div>
<b> <book id="bk102"></b></div>
<div>
<b> <author>Ralls, Kim</author></b></div>
<div>
<b> <title>Midnight Rain</title></b></div>
<div>
<b> <genre>Fantasy</genre></b></div>
<div>
<b> <price>5.95</price></b></div>
<div>
<b> <publish_date>2000-12-16</publish_date></b></div>
<div>
<b> <description>A former architect battles corporate zombies, </b></div>
<div>
<b> an evil sorceress, and her own childhood to become queen </b></div>
<div>
<b> of the world.</description></b></div>
<div>
<b> </book></b></div>
<div>
<b> <book id="bk103"></b></div>
<div>
<b> <author>Corets, Eva</author></b></div>
<div>
<b> <title>Maeve Ascendant</title></b></div>
<div>
<b> <genre>Fantasy</genre></b></div>
<div>
<b> <price>5.95</price></b></div>
<div>
<b> <publish_date>2000-11-17</publish_date></b></div>
<div>
<b> <description>After the collapse of a nanotechnology </b></div>
<div>
<b> society in England, the young survivors lay the </b></div>
<div>
<b> foundation for a new society.</description></b></div>
<div>
<b> </book></b></div>
<div>
<b> <book id="bk104"></b></div>
<div>
<b> <author>Corets, Eva</author></b></div>
<div>
<b> <title>Oberon's Legacy</title></b></div>
<div>
<b> <genre>Fantasy</genre></b></div>
<div>
<b> <price>5.95</price></b></div>
<div>
<b> <publish_date>2001-03-10</publish_date></b></div>
<div>
<b> <description>In post-apocalypse England, the mysterious </b></div>
<div>
<b> agent known only as Oberon helps to create a new life </b></div>
<div>
<b> for the inhabitants of London. Sequel to Maeve </b></div>
<div>
<b> Ascendant.</description></b></div>
<div>
<b> </book></b></div>
<div>
<b> <book id="bk105"></b></div>
<div>
<b> <author>Corets, Eva</author></b></div>
<div>
<b> <title>The Sundered Grail</title></b></div>
<div>
<b> <genre>Fantasy</genre></b></div>
<div>
<b> <price>5.95</price></b></div>
<div>
<b> <publish_date>2001-09-10</publish_date></b></div>
<div>
<b> <description>The two daughters of Maeve, half-sisters, </b></div>
<div>
<b> battle one another for control of England. Sequel to </b></div>
<div>
<b> Oberon's Legacy.</description></b></div>
<div>
<b> </book></b></div>
<div>
<b> <book id="bk106"></b></div>
<div>
<b> <author>Randall, Cynthia</author></b></div>
<div>
<b> <title>Lover Birds</title></b></div>
<div>
<b> <genre>Romance</genre></b></div>
<div>
<b> <price>4.95</price></b></div>
<div>
<b> <publish_date>2000-09-02</publish_date></b></div>
<div>
<b> <description>When Carla meets Paul at an ornithology </b></div>
<div>
<b> conference, tempers fly as feathers get ruffled.</description></b></div>
<div>
<b> </book></b></div>
<div>
<b> <book id="bk107"></b></div>
<div>
<b> <author>Thurman, Paula</author></b></div>
<div>
<b> <title>Splish Splash</title></b></div>
<div>
<b> <genre>Romance</genre></b></div>
<div>
<b> <price>4.95</price></b></div>
<div>
<b> <publish_date>2000-11-02</publish_date></b></div>
<div>
<b> <description>A deep sea diver finds true love twenty </b></div>
<div>
<b> thousand leagues beneath the sea.</description></b></div>
<div>
<b> </book></b></div>
<div>
<b> <book id="bk108"></b></div>
<div>
<b> <author>Knorr, Stefan</author></b></div>
<div>
<b> <title>Creepy Crawlies</title></b></div>
<div>
<b> <genre>Horror</genre></b></div>
<div>
<b> <price>4.95</price></b></div>
<div>
<b> <publish_date>2000-12-06</publish_date></b></div>
<div>
<b> <description>An anthology of horror stories about roaches,</b></div>
<div>
<b> centipedes, scorpions and other insects.</description></b></div>
<div>
<b> </book></b></div>
<div>
<b> <book id="bk109"></b></div>
<div>
<b> <author>Kress, Peter</author></b></div>
<div>
<b> <title>Paradox Lost</title></b></div>
<div>
<b> <genre>Science Fiction</genre></b></div>
<div>
<b> <price>6.95</price></b></div>
<div>
<b> <publish_date>2000-11-02</publish_date></b></div>
<div>
<b> <description>After an inadvertant trip through a Heisenberg</b></div>
<div>
<b> Uncertainty Device, James Salway discovers the problems </b></div>
<div>
<b> of being quantum.</description></b></div>
<div>
<b> </book></b></div>
<div>
<b> <book id="bk110"></b></div>
<div>
<b> <author>O'Brien, Tim</author></b></div>
<div>
<b> <title>Microsoft .NET: The Programming Bible</title></b></div>
<div>
<b> <genre>Computer</genre></b></div>
<div>
<b> <price>36.95</price></b></div>
<div>
<b> <publish_date>2000-12-09</publish_date></b></div>
<div>
<b> <description>Microsoft's .NET initiative is explored in </b></div>
<div>
<b> detail in this deep programmer's reference.</description></b></div>
<div>
<b> </book></b></div>
<div>
<b> <book id="bk111"></b></div>
<div>
<b> <author>O'Brien, Tim</author></b></div>
<div>
<b> <title>MSXML3: A Comprehensive Guide</title></b></div>
<div>
<b> <genre>Computer</genre></b></div>
<div>
<b> <price>36.95</price></b></div>
<div>
<b> <publish_date>2000-12-01</publish_date></b></div>
<div>
<b> <description>The Microsoft MSXML3 parser is covered in </b></div>
<div>
<b> detail, with attention to XML DOM interfaces, XSLT processing, </b></div>
<div>
<b> SAX and more.</description></b></div>
<div>
<b> </book></b></div>
<div>
<b> <book id="bk112"></b></div>
<div>
<b> <author>Galos, Mike</author></b></div>
<div>
<b> <title>Visual Studio 7: A Comprehensive Guide</title></b></div>
<div>
<b> <genre>Computer</genre></b></div>
<div>
<b> <price>49.95</price></b></div>
<div>
<b> <publish_date>2001-04-16</publish_date></b></div>
<div>
<b> <description>Microsoft Visual Studio 7 is explored in depth,</b></div>
<div>
<b> looking at how Visual Basic, Visual C++, C#, and ASP+ are </b></div>
<div>
<b> integrated into a comprehensive development </b></div>
<div>
<b> environment.</description></b></div>
<div>
<b> </book></b></div>
<div>
<b></catalog></b></div>
</div>
<br />
</div>
Unknownnoreply@blogger.com0