[android-developers] JDBC Connectivity through Android

2012-08-30 Thread Arpit parikh


Guys,
Is it possible to connect JDBC connectivity through android emulator?I have 
been tried a lot but could get success.
I have been tried following code :
package com.da;

import java.sql.*;

import android.app.Activity;
import android.os.Bundle;

import android.widget.TextView;

public class DatabaseActivity extends Activity {

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView tv = new TextView(this);
tv.setText(\”orcale Connect Example.\”);
setContentView(tv);

try {

Class.forName(\”com.mysql.jdbc.Driver\”);
Connection con =(Connection) 
DriverManager.getConnection(\”jdbc:mysql://127.0.0.1:3306/co\”, \”root\”, 
\”arpit\”);
Statement st=(Statement) con.createStatement();
st.executeUpdate(\”insert into new_table values(3,5);\”);
tv.setText(\”Connected to the database \”);
} catch (Exception e) {
tv.setText(\”NOT CONNECTED\”);
}
}

}

But it goes into exception every time.Please help me  guide me for this 
issue…!!!

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Using Bluetooth like NFC

2012-08-12 Thread Arpit Jain
Hi,

I need to know whether modification in the software stack of bluetooth can 
be done, so that it will work as NFC. I know that these 2 operates at 
different frequency, so is there any frequency conversion approach 
available so that both can operate at same frequency. And what other things 
need to changed to make it possible.

Thanks  Regards
Arpit Jain
IIT-Bombay

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Can you not stagger custom layout transitions?

2012-07-13 Thread Arpit Mathur
I am trying to stagger a custom layout items added animation to my
application (see  sample code: https://gist.github.com/3107951) using the
new ObjectAnimators and such, and nothing I do seems to allow for
staggering the layout transition? Setting the setStagger does absolutely
nothing.

I am targeting API 14 and testing on a Transformer Prime.

-arpit


Update:
I finally ended up using the older LayoutAnimationController but I thought
the new system would do everything the older one could but better?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Custom layout - why is behavior different when laying out a ViewGroup (vs View) as a child

2012-06-26 Thread Arpit Mathur
I am seeing the exact same thing. Does anyone have an answer to this?


On Friday, March 2, 2012 7:39:16 PM UTC-5, momo wrote:

 I've got a custom layout for positioning tooltips on a pan-n-zoom tiled 
 map (also custom), in reaction to touch events. The tooltips should appear 
 above and centered to the marker that fired it.

 Everything works perfectly when using normal Views (ImageView, TextView) 
 as children. However, when trying to use a ViewGroup (e.g., a 
 RelativeLayout), the child does not appear at all.

 I added some logging to onLayout, and it was reporting 0 for 
 child.getMeasuredWidth()/Height(), so I extended RelativeLayout and 
 overrode onMeasure in order to supply the correct dimensions. The 
 dimensions are now logging correctly, but still the child ViewGroup does 
 not appear. This doesn't seem like it's a necessary step in any case - I'd 
 expect to be able to use layouts as children normally.

 Why is there a difference? Why would a simple View appear and position 
 exactly as expected, but child layouts fail to render at all?

 Here's a summarized version of the custom layout:

 public class TooltipLayout extends ViewGroup {

 public TooltipLayout(Context context) {
 super(context);
 }

 @Override
 protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
 //...
 }

 @Override
 protected void onLayout(boolean changed, int l, int t, int r, int b) {
 int count = getChildCount();
 for (int i = 0; i  count; i++) {
 View child = getChildAt(i);
 if (child.getVisibility() != GONE) {
 TooltipLayout.LayoutParams lp = 
 (TooltipLayout.LayoutParams) child.getLayoutParams();
 child.layout(lp.x, lp.y, lp.x + child.getMeasuredWidth(), 
 lp.y + child.getMeasuredHeight());
 }
 }
 }

 public static class LayoutParams extends ViewGroup.LayoutParams {

 public int x;
 public int y;

 public LayoutParams(int width, int height, int left, int top) {
 super(width, height);
 x = left;
 y = top;
 }
 }
 }

 TYIA.


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: Custom layout - why is behavior different when laying out a ViewGroup (vs View) as a child

2012-06-26 Thread Arpit Mathur
So I think I may have figured this out, though I'd like to see Momo or
someone else confirm this.

The problem seems to have been that in my custom layout that extends
ViewGroup I did override onLayout but not onMeasure. The solution seems to
be to override onMeasure this way:

@Override

protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec){

 // At this time we need to call setMeasuredDimensions(). Lets just call
the

// parent View's method (see
https://github.com/android/platform_frameworks_base/blob/master/core/java/android/view/View.java
)

// that does:

// setMeasuredDimension(getDefaultSize(getSuggestedMinimumWidth(),
widthMeasureSpec),

//getDefaultSize(getSuggestedMinimumHeight(),
heightMeasureSpec));

//

  super.onMeasure(widthMeasureSpec, heightMeasureSpec);


 int wspec =
MeasureSpec.makeMeasureSpec(getMeasuredWidth()/getChildCount(), MeasureSpec.
EXACTLY);

 int hspec = MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.
EXACTLY);

for(int i=0; igetChildCount(); i++){

 View v = getChildAt(i);

 Log.d(TAG, Measured Width / Height: +getMeasuredWidth()+, 
+getMeasuredHeight());

 v.measure(wspec, hspec);

 }

}

I have an example of a custom layout here:

https://github.com/arpit/CustomLayoutExample


Hope this helps.

On Tue, Jun 26, 2012 at 6:57 PM, Arpit Mathur mathur.ar...@gmail.comwrote:

 I am seeing the exact same thing. Does anyone have an answer to this?


 On Friday, March 2, 2012 7:39:16 PM UTC-5, momo wrote:

 I've got a custom layout for positioning tooltips on a pan-n-zoom tiled
 map (also custom), in reaction to touch events. The tooltips should appear
 above and centered to the marker that fired it.

 Everything works perfectly when using normal Views (ImageView, TextView)
 as children. However, when trying to use a ViewGroup (e.g., a
 RelativeLayout), the child does not appear at all.

 I added some logging to onLayout, and it was reporting 0 for
 child.getMeasuredWidth()/**Height(), so I extended RelativeLayout and
 overrode onMeasure in order to supply the correct dimensions. The
 dimensions are now logging correctly, but still the child ViewGroup does
 not appear. This doesn't seem like it's a necessary step in any case - I'd
 expect to be able to use layouts as children normally.

 Why is there a difference? Why would a simple View appear and position
 exactly as expected, but child layouts fail to render at all?

 Here's a summarized version of the custom layout:

 public class TooltipLayout extends ViewGroup {

 public TooltipLayout(Context context) {
 super(context);
 }

 @Override
 protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
 {
 //...
 }

 @Override
 protected void onLayout(boolean changed, int l, int t, int r, int b) {
 int count = getChildCount();
 for (int i = 0; i  count; i++) {
 View child = getChildAt(i);
 if (child.getVisibility() != GONE) {
 TooltipLayout.LayoutParams lp =
 (TooltipLayout.LayoutParams) child.getLayoutParams();
 child.layout(lp.x, lp.y, lp.x + child.getMeasuredWidth(),
 lp.y + child.getMeasuredHeight());
 }
 }
 }

 public static class LayoutParams extends ViewGroup.LayoutParams {

 public int x;
 public int y;

 public LayoutParams(int width, int height, int left, int top) {
 super(width, height);
 x = left;
 y = top;
 }
 }
 }

 TYIA.

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Socket client not recieving data

2011-11-17 Thread Arpit
hi,

I am trying to establish a socket connection between laptop server and
android client phone.
I am able to establish the connection, send data to server but not
able to recieve data from server.though server side is working
f9...

server side coding is in C#.
I am using TCP protocol to establish the socket connection..

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Draw Bar Graph in Android

2011-10-18 Thread Arpit Tandon
I want to draw a *bar *graph in my application, is there any *direct *api's 
available to draw bar graphs in Android.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Right way to animate children inside a viewgroup?

2011-08-22 Thread Arpit Mathur
I am building a custom viewgroup that arranges a bunch of children in a 
particular layout. On a particular trigger (lets say an external button 
press), The children animate to new positions. The way I tried doing it was 
by starting a Timer and on each timer update, computing new positions and 
then calling requestLayout(). Is this the right way? I imagine this could be 
inefficient. 
Any ideas on what the right steps are to do a custom rearragement of child 
views?

-arpit

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Do unique app names mean nothing in the Android Market?

2011-08-05 Thread Arpit Mathur
I released a free app about a week ago, called TimePiece (
https://market.android.com/details?id=com.arpitonline.worldclock). I picked
a name pretty close to the end of the dev process since it seemed less
important. Before publishing to the store I searched for a couple of non
conflicting terms and picked TimePiece since no-one seemed to have used it.

Its been about a week since I added my app. I can find it by searching for
arpitonline which is declared in the package and also as the publisher,
but not by searching for TimePiece (the EXACT name for the app).

Anyone know why this is? And what is the best convention for naming apps for
Market release since exact names seem to count for little.

-arpit

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Do unique app names mean nothing in the Android Market?

2011-08-05 Thread Arpit Mathur
@Kostya Thanks for the link to that form. Just dropped them a line. Lets see
if it does anything.


On Fri, Aug 5, 2011 at 2:59 PM, Kevin Duffey andjar...@gmail.com wrote:

 I too can't find it on my 3 devices. I have wondered how search works on
 the market, because many times I can't find anything close to what I type,
 even though what I type often has apps with the same name as what I typed,
 or similar.


 On Fri, Aug 5, 2011 at 10:12 AM, Kostya Vasilyev kmans...@gmail.comwrote:

 I tried searching for it and couldn't find it either.

 You can try and report this to Google:

 http://www.google.com/support/**androidmarket/developer/bin/**
 request.py?contact_type=**publishinghttp://www.google.com/support/androidmarket/developer/bin/request.py?contact_type=publishing

 -- Kostya

 05.08.2011 21:04, Arpit Mathur пишет:

  I released a free app about a week ago, called TimePiece (
 https://market.android.com/**details?id=com.arpitonline.**worldclockhttps://market.android.com/details?id=com.arpitonline.worldclock).
 I picked a name pretty close to the end of the dev process since it seemed
 less important. Before publishing to the store I searched for a couple of
 non conflicting terms and picked TimePiece since no-one seemed to have used
 it.

 Its been about a week since I added my app. I can find it by searching
 for arpitonline which is declared in the package and also as the
 publisher, but not by searching for TimePiece (the EXACT name for the app).

 Anyone know why this is? And what is the best convention for naming apps
 for Market release since exact names seem to count for little.

 -arpit

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@**
 googlegroups.com android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+**unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/android-developers?hl=enhttp://groups.google.com/group/android-developers?hl=en


 --
 Kostya Vasilyev


 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@**
 googlegroups.com android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+**unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/android-developers?hl=enhttp://groups.google.com/group/android-developers?hl=en


  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: Do unique app names mean nothing in the Android Market?

2011-08-05 Thread Arpit Mathur
Russell, I see what you mean. Thats actually pretty crazy though. Searching
for Time and Piece should still prioritize those words appearing in the
title.

How can search on the Android Market be THIS bad?



On Fri, Aug 5, 2011 at 9:32 PM, Russell DuRoss r2s...@gmail.com wrote:

 If I search with the name in quotes it finds your app, but if I don't
 use quotes, it doesn't (or maybe it's just way down on the list).  My
 guess is that the search without quotes also looks for individual
 words Time and Piece and therefore gets MANY more hits, thus
 relegating your app way down in the list.

 On Aug 5, 1:04 pm, Arpit Mathur mathur.ar...@gmail.com wrote:
  I released a free app about a week ago, called TimePiece (
 https://market.android.com/details?id=com.arpitonline.worldclock). I
 picked
  a name pretty close to the end of the dev process since it seemed less
  important. Before publishing to the store I searched for a couple of non
  conflicting terms and picked TimePiece since no-one seemed to have used
 it.
 
  Its been about a week since I added my app. I can find it by searching
 for
  arpitonline which is declared in the package and also as the publisher,
  but not by searching for TimePiece (the EXACT name for the app).
 
  Anyone know why this is? And what is the best convention for naming apps
 for
  Market release since exact names seem to count for little.
 
  -arpit

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] grid view image gallery

2011-07-19 Thread Arpit Hada
I want to implement an image gallery in grid view where images are
coming from the remote server.
Can anyone please provide any link/code?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Application installation problem in emulator

2011-07-11 Thread Arpit Trivedi
Hello All,

I am novice in android development.my application is not installing on
android emulator even i use simle hello world application.


Thanks  Regards
Arpit

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] error playing youtube video in my app....

2011-07-05 Thread Arpit Hada
HI all,
I am getting a URL from web service which is of YouTube.
I am trying to run it on my device and emulator as well, but it give a
warning message Can't play video.

This is the code I am using:-

String linkURL = intent.getStringExtra(URL);
videoView = (VideoView) findViewById(R.id.video_play);
Uri uri = Uri.parse(linkURL);
videoView.setVideoURI(uri);
videoView.setMediaController(new MediaController(this));
videoView.start();
videoView.requestFocus();

I would appreciate if anyone can help me out.
Thanks!

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] MapOverlay

2011-06-27 Thread Arpit Hada




-- 
Regards,
Arpit Hada

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Lost my app's keystore file and want to update app??

2011-06-16 Thread Arpit Hada
I want to publish updated version of my app but I've lost certificate/
keystore file that I used while publishing the app's previous version.
Is there any way I can upload my updated app and send the notification
to it's active users?
Any help would be appreciated.
Thanks

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: First Application Development

2011-04-28 Thread arpit
this is about sending SMS.. so help me out now..this is regarding my
college project..

On Apr 27, 10:05 pm, Peter Webb r.peter.w...@gmail.com wrote:
 Messages?

 You mean email? You mean instant messaging? You mean SMS? You mean via
 bluetooth? You mean via direct sockets connections? You mean via
 Facebook/Twitter etc APIs ?

 These are all completely different problems, and would be solved in
 very different ways.

 What are you really trying to do, and why? If this is just some random
 problem you picked for fun, and you are new to applications
 development, my advice would be to find a simpler and better defined
 problem to start on.

 On Apr 28, 2:30 am, arpit arpit2...@gmail.com wrote:



  I am new in this app development field,
  I have decided to make a simple application regarding messaging, i.e.
  just send and receive messages..
  so can u help me out in this.. how the messages are sent from one
  device to another..?? or do i have to stay on sending message from one
  emulator to another.??
  what are the overall requirements??(i've fully installed eclipse and
  integrated android too)..
  any particular book having a vast information on messaging services
  and android Telephony package...

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] First Application Development

2011-04-27 Thread arpit
I am new in this app development field,
I have decided to make a simple application regarding messaging, i.e.
just send and receive messages..
so can u help me out in this.. how the messages are sent from one
device to another..?? or do i have to stay on sending message from one
emulator to another.??
what are the overall requirements??(i've fully installed eclipse and
integrated android too)..
any particular book having a vast information on messaging services
and android Telephony package...

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] How to make apps installable to SD card keeping them compatible to version 2.1 and lower ?

2011-03-02 Thread Arpit Mittal
Hi,

I have an app which compatible onwards from 2.1, but with feasibility
of installing apps from 2.2, i added the required attribute
android:installLocation=auto

But using this means i have to make the min version 8, which makes my
app not compatible with 2.1.

I do not want my users of 2.1 to suffer because of incompatibility and
users of 2.2 for unable to install app on SD card.

Is there any other way to achieve both i.e. compatibility and
installation to external memory ?

Regards
Arpit Mittal

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Question on Intents?

2010-09-13 Thread Arpit
I have the a scenario where number of Activites are invoked:

Activity A -- Activity B -- Browser Activity -- Activity C...

By Browser Activity I mean, Activity B will do the following:

String url = http://example.com;;
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));

On Activity C , when user clicks the back button, it always returns to
the Browser Activity. I do not want this to happen...

I understand that each time one Activity calls another, the caller
activity goes onto a stack?? Is it possible to restrict it going onto
the stack, so that when user press back button on Activity C, it goes
to Activity B, skipping the Browser Activity?

Please help!!!

Regards,
Arpit

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Content Providers implementation and closing of DB

2010-09-10 Thread Arpit
I am extending the ContentProvider class and writing content provider
for my app. Some what similar to the tutorial given here http://goo.gl/91WV

What I want to know is, we create a ReadableDatabase or
WriteableDatabase instance in the overridden query method which
returns a cursor.

Now from the android documentation it states that the Database create
is cached when called getReadableDatabase or getWriteableDatabase  on
a SQLiteDatabase instance but it should be closed also.

Now in the query method of ContentProvider extended class, I get the
cursor and that is returned. If I close the DB instance my cursor is
also closed, so if I had fetched some data it vanishes. I can't close
the cursor object also (don't know whether such thing is possible).

So how is the SQLiteDatabase instance is closed finally in such a
design? Can it become problem if I have frequent db queries... like 10
calls per min...?

Please guide me if I have misunderstood the concept somehow?

Regards,
Arpit

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: UriMatcher match not working properly

2010-09-10 Thread Arpit
I had not copied the code here, but re-wrote it in the post. This miss
was because I made mistake while typing.

And I got -1 cause my content provider was getting registered. It was
not a problem

Now I will write the test case as you said and it will also help me
fix the code properly.

Basically, we have code base which I have is written in Donut and I am
helping my customer update it with few new features and run it in both
Eclair and Froyo. And also move it to Gingerbread once it is out...
Providing ContentProvider is a big requirement as app never shared the
data and had local app db.

Regards,
Arpit

On Sep 10, 12:19 am, A. Elk lancaster.dambust...@gmail.com wrote:
 I missed the mismatch as well; it's subtle. In your manifest, you set
 the authority to com.arpit.providers.MyContentProvider, while in the
 code you set it to com.arpit.provider.MyContentProvider. Note the
 missing s for provider in the code. The ContentResolver shouldn't be
 able to resolve your provider, so you should always get back null when
 you call it. This rouses my curiosity; how do you know that UriMatcher
 is always returning -1?

 On the whole, it would be better in this case to do some debugging
 first. If you provide values to a function, but it doesn't act as you
 expect, then either you passed in the wrong values or misunderstood
 the requirements. Check the values for correctness before you assume
 you misunderstood something.

 Content provider users should also consider writing unit tests for
 their providers. ProviderTestCase2 is a good, comprehensive way to
 test a provider in isolation.

 elk.

 On Sep 9, 11:15 am, Brion Emde brione2...@gmail.com wrote:



  You should not hijack existing threads with new questions that do not
  correspond to the original thread. That makes it very difficult for
  people to find the original thread. Instead, you should start a new
  thread with your question.

  That said, I see that the value of the AUTHORITY that you declare in
  your ContentProvider do not match with the android:authority that you
  declare in your AndroidManifest.xml. You should check that they match.

  Finally, rather than giving snippets of code that you think might be
  useful, it is actually more useful if you give a full example.

  On Sep 9, 1:21 am, Arpit robin.ca...@gmail.com wrote:

   Somehow my UriMatcher is not working properly and because of that I am
   not able to do the CRUD operations on my tables.

   I have the following structure of packages and classes:

   com.arpit.provider : This has a class MyContentProvider which extends
   ContentProvider class
   com.arpit.tables :
           DatabaseHelper extends SQLiteOpenHelper
           KeyTable implements BaseColumns
           ParticipantTable implements BaseColumns

   Now in MyContentProvider, I have done the following:

   ...
   public static final String AUTHORITY =
   com.arpit.provider.MyContentProvider;
   ...
   static{
           UriMatcher uriM = new UriMatcher(UriMatcher.NO_MATCH);
           uriM.addUri(AUTHORITY, key, 0);
           uriM.addUri(AUTHORITY, participant, 1);}

   ...
   public Cursor query(Uri uri, String[] projection, String selection,
                           String[] selectionArgs, String sortOrder) {
                   SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
                   switch(uriM.match(uri)){
                           case 0:
                                   qb.setTables(key);
                                   break;
                           case 1:
                                   qb.setTables(participant);
                                   break;
                   }
   }

   ...

   In my KeyTable class, CONTENT_URI = content:// +
   MyContentProvider.AUTHORITY + /key;
   In my ParticipantTable class CONTENT_URI = content:// +
   MyContentProvider.AUTHORITY + /participant;

   In my AndroidManifest.xml file I have registered the provider as:

   provider android:name=com.arpit.providers.MyContentProvider
           android:authorities=com.arpit.providers.MyContentProvider/
   provider

   Now I make the query call with the following statement in my
   HomeActivity:

   Cursor cursor = getContentResolver().query(KeyTable.CONTENT_URI, new
   String[] { KeyTable.col1 }, _id='1', null,  null);

   My problem is when the Query Method is called and the Switch block is
   executed the uriM.match returns always -1 (irrespective of whether it
   is KeyTable.CONTENT_URI or ParticipantTable.CONTENT_URI).

   Could you let me know what wrong am I doing because of which it is not
   working.

   From the note pad example I see during debug the only difference is
   they call managedQuery instead of getContentReslover().query(...). I
   tried firing managedQuery(...) in my HomeActivity class, but that also
   result in uriM.match(uri) to return -1.

   It will be great if you could help me out.

   Thanks  Regards,
   Arpit

   On Aug 25, 10:20 pm, A. Elk lancaster.dambust...@gmail.com

[android-developers] Re: UriMatcher match not working properly

2010-09-09 Thread Arpit
Hi Elk,

Thanks again for your time and specifying your points. Finally I found
out the problem why the code wasn't working after lot of debugging.
Turned out that the table name and the Uri given was wrong. A stupid
typo was the issue.

Also, sorry I can't post the original code as I am under legal
restriction for not publishing my customer's code. Hence, I had to
improvise and write the whole thing.

@Brion,
Sorry for hacking the message. I didn't know this and in future I will
make sure not to hack existing message and will open new one.

Thanks everyone for helping. Finally I am able to make
something...working !!!

~Arpit.

On Sep 9, 11:29 pm, A. Elk lancaster.dambust...@gmail.com wrote:
 As far as I can tell from what you've posted, you're declaring
 CONTENT_URI as a String or some sort of string-related immutable
 class. If you look at the NotePad example, CONTENT_URI is of type Uri,
 and it's constructed using Uri.parse.

 You may be doing this, but what you've posted doesn't indicate it.
 Always be sure to post the exact code you're using.

 My first suggestion is to double-check that you have constructed the
 content URI correctly in the code, using Uri.parse.

 Next, do some debugging. I assume that what you *think* you're passing
 to your content provider is not what is actually getting to it. I also
 assume that you're already doing some debugging, since you know that
 uri.Match is returning -1.

 On Sep 8, 10:21 pm,Arpitrobin.ca...@gmail.com wrote:



  Somehow myUriMatcheris not working properly and because of that I am
  not able to do the CRUD operations on my tables.

  I have the following structure of packages and classes:

  com.arpit.provider : This has a class MyContentProvider which extends
  ContentProvider class
  com.arpit.tables :
          DatabaseHelper extends SQLiteOpenHelper
          KeyTable implements BaseColumns
          ParticipantTable implements BaseColumns

  Now in MyContentProvider, I have done the following:

  ...
  public static final String AUTHORITY =
  com.arpit.provider.MyContentProvider;
  ...
  static{
         UriMatcheruriM = newUriMatcher(UriMatcher.NO_MATCH);
          uriM.addUri(AUTHORITY, key, 0);
          uriM.addUri(AUTHORITY, participant, 1);}

  ...
  public Cursor query(Uri uri, String[] projection, String selection,
                          String[] selectionArgs, String sortOrder) {
                  SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
                  switch(uriM.match(uri)){
                          case 0:
                                  qb.setTables(key);
                                  break;
                          case 1:
                                  qb.setTables(participant);
                                  break;
                  }
  }

  ...

  In my KeyTable class, CONTENT_URI = content:// +
  MyContentProvider.AUTHORITY + /key;
  In my ParticipantTable class CONTENT_URI = content:// +
  MyContentProvider.AUTHORITY + /participant;

  In my AndroidManifest.xml file I have registered the provider as:

  provider android:name=com.arpit.providers.MyContentProvider
          android:authorities=com.arpit.providers.MyContentProvider/
  provider

  Now I make the query call with the following statement in my
  HomeActivity:

  Cursor cursor = getContentResolver().query(KeyTable.CONTENT_URI, new
  String[] { KeyTable.col1 }, _id='1', null,  null);

  My problem is when the Query Method is called and the Switch block is
  executed the uriM.match returns always -1 (irrespective of whether it
  is KeyTable.CONTENT_URI or ParticipantTable.CONTENT_URI).

  Could you let me know what wrong am I doing because of which it is not
  working.

  From the note pad example I see during debug the only difference is
  they call managedQuery instead of getContentReslover().query(...). I
  tried firing managedQuery(...) in my HomeActivity class, but that also
  result in uriM.match(uri) to return -1.

  It will be great if you could help me out.

  Thanks  Regards,
 Arpit

  On Aug 25, 10:20 pm, A. Elk lancaster.dambust...@gmail.com wrote:

   The Note Pad example is pretty good for URI content matching.

   Basically, you define one or more URIs for a ContentProvider. Don't
   think of them as URLs, just think of them as strings with a
   particular format. Using web domains in them is a easy, nearly
   foolproof way to ensure that each URI is unique. For example, I can
   safely use the content URI 
   content://database.lancaster.dambusters.gmail.com
   because that's my unique GMail address.

   Patterns come in when you want a ContentProvider to return different
   things depending on the exact URI. In the Note Pad sample (*not* the
   tutorial), there are 3 patterns corresponding to 3 forms of data: a
   list of notes, a single note, or a set of notes compatible with the
   LiveFolder widget. The list of notes form is set up in the code and
   the manifest so that it returns a set of records. The single note

[android-developers] UriMatcher match not working properly

2010-09-08 Thread Arpit
Somehow my UriMatcher is not working properly and because of that I am
not able to do the CRUD operations on my tables.

I have the following structure of packages and classes:

com.arpit.provider : This has a class MyContentProvider which extends
ContentProvider class
com.arpit.tables :
DatabaseHelper extends SQLiteOpenHelper
KeyTable implements BaseColumns
ParticipantTable implements BaseColumns


Now in MyContentProvider, I have done the following:

...
public static final String AUTHORITY =
com.arpit.provider.MyContentProvider;
...
static{
UriMatcher uriM = new UriMatcher(UriMatcher.NO_MATCH);
uriM.addUri(AUTHORITY, key, 0);
uriM.addUri(AUTHORITY, participant, 1);
}
...
public Cursor query(Uri uri, String[] projection, String selection,
String[] selectionArgs, String sortOrder) {
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
switch(uriM.match(uri)){
case 0:
qb.setTables(key);
break;
case 1:
qb.setTables(participant);
break;
}

}
...

In my KeyTable class, CONTENT_URI = content:// +
MyContentProvider.AUTHORITY + /key;
In my ParticipantTable class CONTENT_URI = content:// +
MyContentProvider.AUTHORITY + /participant;

In my AndroidManifest.xml file I have registered the provider as:

provider android:name=com.arpit.providers.MyContentProvider
android:authorities=com.arpit.providers.MyContentProvider/
provider

Now I make the query call with the following statement in my
HomeActivity:

Cursor cursor = getContentResolver().query(KeyTable.CONTENT_URI, new
String[] { KeyTable.col1 }, _id='1', null,  null);

My problem is when the Query Method is called and the Switch block is
executed the uriM.match returns always -1 (irrespective of whether it
is KeyTable.CONTENT_URI or ParticipantTable.CONTENT_URI).

Could you let me know what wrong am I doing because of which it is not
working.

From the note pad example I see during debug the only difference is
they call managedQuery instead of getContentReslover().query(...). I
tried firing managedQuery(...) in my HomeActivity class, but that also
result in uriM.match(uri) to return -1.

It will be great if you could help me out.

Thanks  Regards,
Arpit

On Aug 25, 10:20 pm, A. Elk lancaster.dambust...@gmail.com wrote:
 The Note Pad example is pretty good for URI content matching.

 Basically, you define one or more URIs for a ContentProvider. Don't
 think of them as URLs, just think of them as strings with a
 particular format. Using web domains in them is a easy, nearly
 foolproof way to ensure that each URI is unique. For example, I can
 safely use the content URI content://database.lancaster.dambusters.gmail.com
 because that's my unique GMail address.

 Patterns come in when you want a ContentProvider to return different
 things depending on the exact URI. In the Note Pad sample (*not* the
 tutorial), there are 3 patterns corresponding to 3 forms of data: a
 list of notes, a single note, or a set of notes compatible with the
 LiveFolder widget. The list of notes form is set up in the code and
 the manifest so that it returns a set of records. The single note
 returns exactly one note, and I forget offhand what LiveFolders does.
 Let's look at the first two.

 For set of notes, you just specify a base URI. The Provider returns
 all the notes in the database that match your criteria.

 For a single note, you specify a pattern that is the single note
 base URI with a note ID number appended to it. The ID number is the
 value of the _ID column for the record you want. The Provider
 returns that particular note. As written, the Provider can also filter
 the note by selection criteria.

 If you look in the code for the Provider, you'll see that it defines 
 aUriMatcher. You useUriMatcher.addUri() to match an authority (a
 base URI without a specific pattern) and a pattern to a value. When a
 URI comes in to the query() method, you useUriMatcher.match to match
 the incoming URI to a pattern. The method returns the value that you
 associated with the pattern in addUri(). TheUriMatcheris defined in
 a static block at the end of the code.

 As a note, you can use ? in a pattern as a wildcard to match any
 string, and # to match any number. The # is used to match a single
 note in Note Pad.

 The Note Pad code is hard to understand because it's designed to
 accept alternate actions. This allows other apps to access the
 ContentProvider by specifying the proper authority and MimeType. You
 can ignore this, basically. The mime type tells the calling app what
 it's gonna get back from the Provider. If the type is
 vnd.android.cursor.dir, then the calling app knows it may get back
 more than one row, whereas if it gets back cursor.item, it gets back
 only one item

[android-developers] Content-Encoding: gzip,deflate

2010-08-28 Thread Arpit
Hi All,

I am using the Apache HttpClient and added the header Accept-
Encoding and gzip,deflate. But when I check the header of the
response I always get the Content-Encoding header as empty.

In the header array of the response I can see that Content-Type:
application/xml; charset=utf-8 as one of the value.

My questions are:

a) Is there a way to check whether a server support gzip content
encoding?
b) If no, how can I find out from Apache HttpClient whether the
content received is in gzip content encoding?

Please help.

Thanks  Regards,
Arpit.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: About ContentProvider designing in my App

2010-08-25 Thread Arpit
Thank you all for answering and guiding me with the design. I wanted
to know whether multiple tables can be part of a content provider. I
have one database and my requirement is to share the DB across
application and hence the Content Provider.

And after normalizing my tables, I realize a single content provider
will be sufficient to handle all the tables in my db. Though I am
struggling a little with URI matching concept, so trying some code
like NoteList example. Once I run my own code, may be i will
understand better.

Thanks for the info, it help me a lot with the design.

Regards,
Arpit

On Aug 24, 10:51 pm, A. Elk lancaster.dambust...@gmail.com wrote:
 There are two considerations: database design and application design.

 Database design is much too big of a topic to summarize in a single
 thread! But in short, one wants to normalize the data and do joins to
 combine data from different tables.

 Application design in Android suggests that a ContentProvider isn't
 necessary for private data. Basically, if you don't want to let other
 applications look at your data (or modify it, or delete it) by
 themselves, then you don't really need a ContentProvider. Of course,
 you can have one if you want. You lose a bit of security, since the
 data becomes public, although you can keep pretty much private by
 using an obscure URI.

 Also, it's best to have one database per ContentProvider. If you find
 yourself trying to associate more than one database with the same
 ContentProvider, your design may be suspect. Remember that a single
 database can contain address data, book data, and people data, if the
 domain is library management. On the other hand, you may choose to use
 the built-in Contacts provider for people/address and your own
 ContentProvider for books.

 In short, there's no one answer, except that you aren't limited to one
 table per ContentProvider, one database per ContentProvider, or one
 ContentProvider per Android application. A ContentProvider has some
 overhead, but I'd opt for one per database rather than worry about the
 overhead.

 On Aug 24, 9:17 am, Kostya Vasilyev kmans...@gmail.com wrote:



    A ContentProvider is queried (and updated) using a URI, which
  specifies the kind of data to work with. This might look like this:

  content://provider/counties
  content://provider/counties/country_id

  content//provider/counties/country_id/cities
  content//provider/counties/country_id/cities/city_id

  Or even like this, in addition to the above:

  content://provider/books
  content://provider/books/book_id

  A helper class, UriMatcher, can be used in ContentProvider
  implementation to quickly and easily determine what kind of data a
  request URI refers to - whether it's counties, or cities, or a country
  by its id (in the examples above).

  One the kind of data that the URI refers to is known, it's quite logical
  to store each kind of data in its own table (e.g. country / city).

  I also think it makes sense to implement separate ContentProviders for
  unrelated sets of data.

  In the example above, if you're not linking books to cities, you might have:

  content://name.Arpit.GeographyData/counties
  content://name.Arpit.GeographyData/counties/1
  content://name.Arpit.GeographyData/counties/1/cities

  ...etc... and:

  content://name.Arpit.Library/books
  content://name.Arpit.Library/books/1
  content://name.Arpit.Library/books/2

  -- Kostya

  24.08.2010 20:01, Arpit пишет:

   Hi All,

   All the example codes, tutorials or video I see, there is always one
   ContentProvider per SQL Table with the SQLiteOpenHelper extension
   defined as a private static class...

   Is it some sort of standard design...to have one ContentProvider per
   SQL Table? Or I can define one generic ContentProvider and use its
   instance for ever update?

   Is there some issue with that?

   Could anyone please help as my application has like 5-6 tables.

   Regards,
   Arpit

  --
  Kostya Vasilev -- WiFi Manager + pretty widget 
  --http://kmansoft.wordpress.com

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] About ContentProvider designing in my App

2010-08-24 Thread Arpit
Hi All,

All the example codes, tutorials or video I see, there is always one
ContentProvider per SQL Table with the SQLiteOpenHelper extension
defined as a private static class...

Is it some sort of standard design...to have one ContentProvider per
SQL Table? Or I can define one generic ContentProvider and use its
instance for ever update?

Is there some issue with that?

Could anyone please help as my application has like 5-6 tables.

Regards,
Arpit

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Problem with SD cards

2010-08-18 Thread Arpit
Dear All,

Right now i am getting some issue while creating one backup sms app.
Problem is how can i backup db file from sd card and vice versa.

Hope for reply

Arpit

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Graphical modeling on Android

2010-07-21 Thread Arpit
Hi All,

We are evaluating mobile technologies for Graphical modeling. I would
like to know if anyone know if some sort of Graphical Modeling is
possible in Android?

Thanks  Regards,
Arpit

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] WebView / HTTPClient shared cookies ?

2010-05-24 Thread Arpit Mathur
An Android app I am building requires web authentication for users to make
data calls. In Adobe AIR and later the iPhone, we did this by rendering a
login page in a webview-equivalent page and setting a cookie when the user
signs in. Subsequent data calls use the same Cookie Jar and so are seen as
authenticated.

In the Android version, I authenticate the user using a WebView and then
once thats done, I make a data call using DefaultHttpClient, however I cant
seem to load the data on the second call.

Is there some cookie gotcha I am missing? I imagine the HTTPClient and
WebView would share the same Cookie space. Am I wrong?

-- 
--
Arpit Mathur
twitter: http://twitter.com/arpit
blog: http://arpitonline.com/blog
---

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] examine http headers from httpClient

2010-05-24 Thread Arpit Mathur
I have some code that constructs cookies and other http headers and then
sends the information over the network to a server. I am getting 403s from
the server and I am not sure why. Is there any way to check the http headers
being sent? Using Charles Web Debugging Proxy has failed and I am not that
well versed in wire shark but if someone tells me a way it would really save
my ass.

thanks


-- 
--
Arpit Mathur
twitter: http://twitter.com/arpit
blog: http://arpitonline.com/blog
---

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Pass ArrayList parameters between two activities.

2010-04-20 Thread Arpit
This works if I change the class Services from being Parceable to
Serializable it works... I am not sure why... but between Activity
when I am sending Serialized data it works but not if I send parceable
data.

Regards,
Arpit

On Apr 20, 10:31 am, Arpit robin.ca...@gmail.com wrote:
 Similar problem but this doesn't work. Following steps exists in my
 apps and still not able to send data part of Intent (putExtras) from
 one activity to another:

 - Activity A is of type ListActivity showing some buttons.
 - Any button click shows a Login screen (AlertDialog).
 - onCreateDialog is implemented and I have two buttons on the
 AlertDialog, Ok  Cancel, both having listener for onClick event. I
 realize that if I try to start activity within onClick event of OK
 BUTTON, the activity wont start.
 - So I implemented onDismissListener and started activity from here.
 - Now I call Activity B and passing new Intent where I have put extra
 (Parcelable object)

 In activity B the parcelable object comes empty... No info in it.

 Code below:

 Activity A (HomeActivity)

 @Override
                                 public void onDismiss(DialogInterface dialog) 
 {
                                         try{
                                                 HomeActivity home = 
 (HomeActivity)
 ((AlertDialog)dialog).getOwnerActivity();
                                                 Intent oldIntent = 
 home.getIntent();
                                                 oldIntent.setClass(home, 
 ServiceListActivity.class);
                                                 
 home.startActivityForResult(oldIntent,0);
                                         }catch(Exception e){
                                                 
 Toast.makeText(HomeActivity.this, R.string.error_occured,
 Toast.LENGTH_LONG).show();
                                         }
                                 }

 Activity B (ServiceListActivity)

 public void onCreate(Bundle savedInstanceState){
                 try{
                         super.onCreate(savedInstanceState);
                         setContentView(R.layout.middle_man);
                         Intent i = super.getIntent();
                         Bundle b = i.getExtras();
                         IteratorString iterator = b.keySet().iterator();
                         Services a = null;
                         while(iterator.hasNext()){
                                 a = 
 (Services)b.getParcelable(iterator.next());
                         }
                         Services s = 
 (Services)b.get(ServicesConstants.SERVICE_SELECTED);
 ...
 ...

 Both 'a' and 's' comes null. They are type object Services which is
 Parceable in nature.

 Regards,
 Arpit

 On Apr 20, 1:50 am, ~ TreKing treking...@gmail.com wrote:





  On Mon, Apr 19, 2010 at 1:24 AM, Ke Wu kerl@gmail.com wrote:
   I dont know what the Intent exactly do when I use putExtra to pass in an
   ArrayListMyClass object.

  Did you read the documentation on Intents? Specifically 
  this:http://developer.android.com/intl/fr/reference/android/content/Intent...,
  java.util.ArrayList? extends android.os.Parcelable)

   I guess MyClass need to implement Parcelable interface, so I just did it.
   But still, it does not work.

  You guess right. If it does not work, you should explain what doesn't work.
  Just saying it does not work is useless to someone trying to help you.

   Maybe I need to create a Bundle and then use Bundle' 
   putParcelableArrayList
   method to put my ArrayListMyClass object in, and then pass this bundle 
   as
   parameter of putExtra to the intent.

  No.

   So crazy!

  Not really!

   I am lazy

  Then you should not being doing Android development ... or any kind of
  programming for that matter.

   , I just want to pass an ArrayListMyClass object simply, is there a
   simple way??

    Any suggestion would be greatly appreciated!

  See the link I posted.

  On Mon, Apr 19, 2010 at 3:23 AM, Kumar Bibek coomar@gmail.com wrote:
   However, a cheap workaround would be to have this arraylist as a static
   variable of your source activity. This way, you can access this Array List
   from your destination activity

  Except that by doing this, you have to make sure the list is actually valid.
  If you start Activity A, fill the list, start Activity B, press Home, wait a
  while, come back to your app, your app may have been killed since you
  started it, the list will be empty, but you will be back in Activity B. If
  you don't validate that list and save and restore it somehow, you will run
  into trouble trying to access the empty (or null) list.

  ---­­--
  TreKing - Chicago transit tracking app for Android-powered 
  deviceshttp://sites.google.com/site/rezmobileapps/treking

  --
  You received this message because you are subscribed to the Google
  Groups Android Developers group

[android-developers] Re: Pass ArrayList parameters between two activities.

2010-04-19 Thread Arpit
Similar problem but this doesn't work. Following steps exists in my
apps and still not able to send data part of Intent (putExtras) from
one activity to another:

- Activity A is of type ListActivity showing some buttons.
- Any button click shows a Login screen (AlertDialog).
- onCreateDialog is implemented and I have two buttons on the
AlertDialog, Ok  Cancel, both having listener for onClick event. I
realize that if I try to start activity within onClick event of OK
BUTTON, the activity wont start.
- So I implemented onDismissListener and started activity from here.
- Now I call Activity B and passing new Intent where I have put extra
(Parcelable object)

In activity B the parcelable object comes empty... No info in it.

Code below:

Activity A (HomeActivity)

 
@Override
public void onDismiss(DialogInterface dialog) {
try{
HomeActivity home = 
(HomeActivity)
((AlertDialog)dialog).getOwnerActivity();
Intent oldIntent = 
home.getIntent();
oldIntent.setClass(home, 
ServiceListActivity.class);

home.startActivityForResult(oldIntent,0);
}catch(Exception e){

Toast.makeText(HomeActivity.this, R.string.error_occured,
Toast.LENGTH_LONG).show();
}
}

Activity B (ServiceListActivity)

public void onCreate(Bundle savedInstanceState){
try{
super.onCreate(savedInstanceState);
setContentView(R.layout.middle_man);
Intent i = super.getIntent();
Bundle b = i.getExtras();
IteratorString iterator = b.keySet().iterator();
Services a = null;
while(iterator.hasNext()){
a = (Services)b.getParcelable(iterator.next());
}
Services s = 
(Services)b.get(ServicesConstants.SERVICE_SELECTED);
...
...

Both 'a' and 's' comes null. They are type object Services which is
Parceable in nature.

Regards,
Arpit


On Apr 20, 1:50 am, ~ TreKing treking...@gmail.com wrote:
 On Mon, Apr 19, 2010 at 1:24 AM, Ke Wu kerl@gmail.com wrote:
  I dont know what the Intent exactly do when I use putExtra to pass in an
  ArrayListMyClass object.

 Did you read the documentation on Intents? Specifically 
 this:http://developer.android.com/intl/fr/reference/android/content/Intent...,
 java.util.ArrayList? extends android.os.Parcelable)

  I guess MyClass need to implement Parcelable interface, so I just did it.
  But still, it does not work.

 You guess right. If it does not work, you should explain what doesn't work.
 Just saying it does not work is useless to someone trying to help you.

  Maybe I need to create a Bundle and then use Bundle' putParcelableArrayList
  method to put my ArrayListMyClass object in, and then pass this bundle as
  parameter of putExtra to the intent.

 No.

  So crazy!

 Not really!

  I am lazy

 Then you should not being doing Android development ... or any kind of
 programming for that matter.

  , I just want to pass an ArrayListMyClass object simply, is there a
  simple way??

   Any suggestion would be greatly appreciated!

 See the link I posted.

 On Mon, Apr 19, 2010 at 3:23 AM, Kumar Bibek coomar@gmail.com wrote:
  However, a cheap workaround would be to have this arraylist as a static
  variable of your source activity. This way, you can access this Array List
  from your destination activity

 Except that by doing this, you have to make sure the list is actually valid.
 If you start Activity A, fill the list, start Activity B, press Home, wait a
 while, come back to your app, your app may have been killed since you
 started it, the list will be empty, but you will be back in Activity B. If
 you don't validate that list and save and restore it somehow, you will run
 into trouble trying to access the empty (or null) list.

 ---­--
 TreKing - Chicago transit tracking app for Android-powered 
 deviceshttp://sites.google.com/site/rezmobileapps/treking

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group 
 athttp://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send

[android-developers] How to change File permission

2010-02-18 Thread Arpit
Hello,

Is there a way to change file permission to world readable  when we
use File Api to create a file like this

File file = new File((File)directory, hello.txt);

here directory is private directory other then files.

Thanks
Arpit Pradhan

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Media player API's and File Permission problem

2010-02-15 Thread Arpit
Hello,

I am facing problem in playing mp3 file using mediaplayer API's.

File is in application private folder say app_xyz

file permission is  -rw---  when file is created using File
API's.

So is there any way to change the file permission to -rw-rw---.
without moving it to system folder say files

Thanks
Arpit Pradhan

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en