[android-developers] Re: Please guide me how to send data(datastream, not files) from a PC to a real android phone via USB.

2012-02-18 Thread vvis
Thx a lot, I will try reverse tethering via USB, and connect the PC
and the mobile phone ag.. I think that is the most immediate way to
go.

On 2月14日, 下午12时34分, Lew lewbl...@gmail.com wrote:
 vvis wrote:

  I want to send data(datastream, not files) from a PC to a real android
  phone via USB.

  I coded and set the phone to be a SERVER ,PC to be a CLIENT, and it
  worded.

  And, when I  set the Simulator to be a CLIENT,PC to be a SERVER , it
  worded too.

  BUT, when I  set the REAL Phone to be a CLIENT,PC to be a SERVER ,  it
  did not word at all!!!

  Code is like:
  PC:
  Runtime.getRuntime().exec(adb forward tcp:12580 tcp:10086);
  serverSocket = new ServerSocket(12580);

  Android:
  socket = new Socket(InetAddress.getByName(127.0.0.1), 12580);

 This code fragment asks for a connection to port 12580 on the device
 itself.  So you are asking the Android device to connect to a socket on the
 same Android device.  Is that what you intended?

 //While on the  Simulator use 10.0.2.2 it works!!!

 You don't show code or describe your configuration, so I'm not clear on
 what you mean by works.  But generally you don't have a network
 connection between the device and your PC.  It takes something called
 reverse tethering via USB.  The emulator runs on the same network as its
 host, which is why you had no trouble there.

 When Googling the terminology myself just now, I came across this
 badly-written but potentially useful little 
 article:http://www.codeproject.com/Articles/191930/Android-Usb-Port-Forwarding

 There are problems with reverse tethering; tread carefully.

 So you have two problems.  You're trying to connect the Android device to
 itself, and you have no network connection from the device to the PC.

 --
 Lew

-- 
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] handled the android.nfc.action.TRANSACTION_DETECTED event

2012-02-18 Thread tarun sablok
Hii

Add the DEFAULT   Category as well in the Intent  filter , i think it will
work out for  you

   action
android:name=android.nfc.action.TRANSACTION_DETECTED /
category android:name=android.intent.category.DEFAULT  /
   /intent-filter

Well  i am also working in NFC  making applications on Google Nexus S ... I
think you are also working in card Emulation mode..
can you give me some pointers  how to go ahead with Card Emulation
 applications , actually i am struggling to get the things up.

cheers

tarun


On Thu, Feb 16, 2012 at 1:57 PM, Usman linkusma...@gmail.com wrote:

 I am struggling to handle android.nfc.action.TRANSACTION_DETECTED
 event. The device is NFC and also contains secure element which
 supports SWP to the UICC.
 I have registered the following BroadCast receiver in my app.
 public class TransactionReceiver extends BroadcastReceiver {

private String TAG = TransactionReceiver;

@Override
public void onReceive(Context context, Intent intent) {
Log.d(TAG, Transaction performed ...);

}

 }

 Below is my manifest.
 ?xml version=1.0 encoding=utf-8?
 manifest xmlns:android=http://schemas.android.com/apk/res/android;
package=com.mycompany.android.nfc.uicc.test
android:versionCode=1
android:versionName=1.0 

uses-sdk android:minSdkVersion=10 /

application
android:icon=@drawable/ic_launcher
android:label=@string/app_name 
activity
android:name=.AndroidUiccTestActivity
android:label=@string/app_name 
intent-filter
action android:name=android.intent.action.MAIN /

category
 android:name=android.intent.category.LAUNCHER /
/intent-filter
/activity

receiver
android:name=.TransactionReceiver
android:enabled=true 
intent-filter
action
 android:name=android.nfc.action.TRANSACTION_DETECTED /
/intent-filter
/receiver
/application

uses-permission android:name=android.permission.NFC /
 /manifest

 I am not receiving the broadcast event when I present the device on
 the contactless reader. Could anyone point out if I am missing
 anything or if following the right route.
 The android.nfc.action.TRANSACTION_DETECTED is hidden from the google
 api but can found at
 http://www.androidjavadoc.com/2.3/android/nfc/NfcAdapter.html#ACTION_TRANSACTION_DETECTED
 .

 thanks in advance

 --
 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] test cases are in a different package

2012-02-18 Thread fei ji

 If test cases are put in the same package, then release version will
 contain test project.


who is going to do that? the test cases are in a separate project?

In android, test project is usually put in a directory called tests under
the tested project.
If it is a sub-project of the under testing project.

On Sat, Feb 18, 2012 at 8:31 AM, Ray Tayek rta...@ca.rr.com wrote:

 At 03:06 PM 2/17/2012, you wrote:

  If test cases are put in the same package, then release version will
 contain test project.


 who is going to do that? the test cases are in a separate project?


  And you should only test public interface.


 i disagree. i usually test non-public classes and methods.

 thanks

  在 2012-2-18 ä¸Šå ˆ6:21,Ray Tayek mailto:rta...@ca.rr.comrtay**
 e...@ca.rr.com rta...@ca.rr.comå†™é “ï¼š

 having the test cases in a different package make it hard to test methods
 and classes with protected or the default visibility.

 is there some reason why the test cases are put into a separate package?

 placing them in the same package seems to work ok.

 am going to run into trouble by doing this? ...


 ---
 co-chair http://ocjug.org/

 --
 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.comandroid-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

[android-developers] No text visible in edittext

2012-02-18 Thread mohit verma
Hi guys,
I am having a string containing some words.
Now in a for loop , i traverse the string and according to some condition i
set the color and try to display text in this way:

while(not reached string length)
{

if(condition1)  my_edittext.setColor(Color.RED);

else if(condition2) my_edittext.setColor(Color.BLUE);

and so on.

}

my_edittext.setText(substring);

}

Guys, i want my edittext to be filled-up by this colorfull string on
activity startup(I mean without any actions yet performed on UI).

When i do all this. in some string test cases , last word of my string
appears in edittext but in other cases ... no string at all.

Could someone please help me correct my way of implementation?

Thanks in advance


-- 
Mohit

-- 
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] Avoiding FAILED BINDER TRANSACTION error when updating lots of widget bitmaps

2012-02-18 Thread YuviDroid
Hi Dianne,

thanks for your reply. The problem is that I'm using
RemoteViews.setImageViewUri(), so I don't have a bitmap object to set the
density.
The Uri I'm using is content://... which reaches my ContentProvider at
the method openFile(Uri,String).

I looked at the Android source code and I see that ImageView.setImageUri()
uses resolveUri(), and for the content scheme it
calls 
Drawable.createFromStream(mContext.getContentResolver().openInputStream(mUri),
null);
which calls my openFile() method, which I implemented like this:
public ParcelFileDescriptor openFile(Uri uri, String mode) throws
FileNotFoundException {
File file = new File(getContext().getFilesDir(), MyFile.png);

return ParcelFileDescriptor.open(file,
ParcelFileDescriptor.MODE_READ_ONLY);
}

I don't see where I can change the density to use. :(


Thanks,
Yuvi


On Sat, Feb 18, 2012 at 2:19 AM, Dianne Hackborn hack...@android.comwrote:

 Set the desired density of your bitmap:
 http://developer.android.com/reference/android/graphics/Bitmap.html#setDensity(int)


 On Fri, Feb 17, 2012 at 12:56 PM, YuviDroid yuvidr...@gmail.com wrote:

 Hi,

 sorry to resurrect this post...but I got into a similar problem. And as
 the OP did, I'm using RemoteViews.setImageViewUri() to set my image on the
 appwidget. However I noticed that my image is being scaled according to the
 screen density.

 So, for example, on an XHDPI screen, if I have a bitmap which is 100x100
 and I set it using setImageViewBitmap() I get the image to look as 100x100.
 However, if I store that bitmap into a png on disk, and then use
 setImageViewUri() my bitmap is displayed as 50x50.

 Do you know if there is a way to change this behavior? (i.e. if my image
 is 100x100 I'd like it to remain 100x100 also after it is decoded).
 Maybe there is a way to force some density on the ImageView itself?

 My only workaround (which sucks..) is to scale-up the bitmap before
 storing on disk so that when it is being decoded I get back my original
 size. But in this way I use more memory to save the image and I also loose
 image quality..:(

 I hope someone can help me!
 Thanks,
 Yuvi

 On Mon, Aug 1, 2011 at 8:05 PM, Ash McConnell ash.mcconn...@gmail.comwrote:

 Thanks Kostya and Dianne, setUri works as expected.  I had to create the
 files using context.openFileOutput.  Unfortunately that means I loose the
 ability to use directories.  I can't see a Java way to set permission on
 files, it can be done with native methods, but that seems like overkill.
  I'll do some more googling.

 Thanks again for the help, I was worried that this problem might have
 been a show-stopper.
 Ash

  --
 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




 --
 YuviDroid
 Check out Launch-X http://android.yuvalsharon.net/launchx.php (a
 widget to quickly access your favorite apps and contacts!)
 http://android.yuvalsharon.net

  --
 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




 --
 Dianne Hackborn
 Android framework engineer
 hack...@android.com

 Note: please don't send private questions to me, as I don't have time to
 provide private support, and so won't reply to such e-mails.  All such
 questions should be posted on public forums, where I and others can see and
 answer them.

  --
 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




-- 
YuviDroid
Check out Launch-X http://android.yuvalsharon.net/launchx.php (a widget
to quickly access your favorite apps and contacts!)
http://android.yuvalsharon.net

-- 
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] Avoiding FAILED BINDER TRANSACTION error when updating lots of widget bitmaps

2012-02-18 Thread Mark Murphy
On Sat, Feb 18, 2012 at 8:40 AM, YuviDroid yuvidr...@gmail.com wrote:
 thanks for your reply. The problem is that I'm using
 RemoteViews.setImageViewUri(), so I don't have a bitmap object to set the
 density.

Then switch to setBitmap() or setImageViewBitmap().

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android App Developer Books: http://commonsware.com/books

-- 
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] Nexus S

2012-02-18 Thread Satyajit Sarangi
Does anyone have  a Google Nexus S for sale in India? Its rather urgent.
Thank you!

-- 
*Satyajit Sarangi*

-- 
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] Avoiding FAILED BINDER TRANSACTION error when updating lots of widget bitmaps

2012-02-18 Thread YuviDroid
Hi Mark,

I actually switched from setImageViewBitmap() to setImageViewUri() because
sometimes I need to display large bitmaps which do not work if I use
setImageViewBitmap().


Yuvi

On Sat, Feb 18, 2012 at 2:57 PM, Mark Murphy mmur...@commonsware.comwrote:

 On Sat, Feb 18, 2012 at 8:40 AM, YuviDroid yuvidr...@gmail.com wrote:
  thanks for your reply. The problem is that I'm using
  RemoteViews.setImageViewUri(), so I don't have a bitmap object to set the
  density.

 Then switch to setBitmap() or setImageViewBitmap().

 --
 Mark Murphy (a Commons Guy)
 http://commonsware.com | http://github.com/commonsguy
 http://commonsware.com/blog | http://twitter.com/commonsguy

 Android App Developer Books: http://commonsware.com/books

 --
 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




-- 
YuviDroid
Check out Launch-X http://android.yuvalsharon.net/launchx.php (a widget
to quickly access your favorite apps and contacts!)
http://android.yuvalsharon.net

-- 
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] Mounting multiple devices at once

2012-02-18 Thread New Developer

Using  Linux
I have set up my /etc/fstab  to mount using fuse  and mtpfs
But How do I set up to mount multiple devices at once.

Would like to be able to connect two or three tablets and transfer data 
between them


Thanks in advance

--
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: Method oddly not working, help needed.

2012-02-18 Thread Jeresam515
Bump

On Feb 17, 9:09 pm, Jeresam515 jeremyschiff...@gmail.com wrote:
 Here is my method for part of a calculator app, could someone take a
 look and see why it isnt working?(PS is parenthases start while PE is
 end)
 Boolean solve2( int min, int max){
                 int x = min-1;
                 while(xmax)
                 {
                         x++;
                         Cursor note = mDbHelper.fetchNote(x);

 if(Boolean.parseBoolean(note.getString(note.getColumnIndexOrThrow(NotesDbAd 
 apter.KEY_ISPS
                         {
                         int y = x;
                         boolean z = false;
                         while(ymax  z==false){
                                 y++;
                         Cursor note1 = mDbHelper.fetchNote(y);

 if(Boolean.parseBoolean(note1.getString(note.getColumnIndexOrThrow(NotesDbA 
 dapter.KEY_ISPE
                         {z = true;}
                         }
                         solve1(x,y);
                 max-=(y-x);
                 }}
                 int xa = min-1;
                 while(xamax)
                 {
                         xa++;
                         Cursor note2 = mDbHelper.fetchNote(xa);

 if(Boolean.parseBoolean(note2.getString(note2.getColumnIndexOrThrow(NotesDb 
 Adapter.KEY_ISPOWER
                         {
                         int ya = xa+1;
                         int za = xa-1;
                         Cursor note3 = mDbHelper.fetchNote(ya);
                         Cursor note4 = mDbHelper.fetchNote(za);

          double n =
 Double.valueOf(note3.getString(note3.getColumnIndexOrThrow(NotesDbAdapter.K 
 EY_VALUE)));
          double m =
 Double.valueOf(note4.getString(note4.getColumnIndexOrThrow(NotesDbAdapter.K 
 EY_VALUE)));
         double g = Math.pow(n,m);
         double da = g;
         mDbHelper.updateNote(da, false, false, false, false, false, false, 0,
 za, false, false);
         mDbHelper.deleteNote(xa);
         mDbHelper.deleteNote(xa);
         max -=2;
                         }

 if(Boolean.parseBoolean(note2.getString(note2.getColumnIndexOrThrow(NotesDb 
 Adapter.KEY_ISROOT
                         {
                         int aya = xa+1;
                         int aza = xa-1;
                         Cursor anote3 = mDbHelper.fetchNote(aya);
                         Cursor anote4 = mDbHelper.fetchNote(aza);
          double an =
 Double.valueOf(anote3.getString(anote3.getColumnIndexOrThrow(NotesDbAdapter 
 .KEY_VALUE)));
          double am =
 Double.valueOf(anote4.getString(anote4.getColumnIndexOrThrow(NotesDbAdapter 
 .KEY_VALUE)));
         double ag = Math.pow(an,1/am);
         double ada = ag;
         mDbHelper.updateNote(ada, false, false, false, false, false, false,
 0, aza, false, false);
         mDbHelper.deleteNote(xa);
         mDbHelper.deleteNote(xa);
         max -=2;
                         }
                 }
                 int xb = min-1;
                 while(xbmax)
                 {
                         xb++;
                         Cursor note2 = mDbHelper.fetchNote(xb);

 if(Boolean.parseBoolean(note2.getString(note2.getColumnIndexOrThrow(NotesDb 
 Adapter.KEY_ISMULTIPLIER
                         {
                         int yb = xb+1;
                         int zb = xb-1;
                         Cursor note3 = mDbHelper.fetchNote(yb);
                         Cursor note4 = mDbHelper.fetchNote(zb);

          double n =
 Double.valueOf(note3.getString(note3.getColumnIndexOrThrow(NotesDbAdapter.K 
 EY_VALUE)));
          double m =
 Double.valueOf(note4.getString(note4.getColumnIndexOrThrow(NotesDbAdapter.K 
 EY_VALUE)));
         double g = n*m;
         double db = g;
         mDbHelper.updateNote(db, false, false, false, false, false, false, 0,
 zb, false, false);
         mDbHelper.deleteNote(xb);
         mDbHelper.deleteNote(xb);
         max -=2;
                         }

 if(Boolean.parseBoolean(note2.getString(note2.getColumnIndexOrThrow(NotesDb 
 Adapter.KEY_ISDIVISOR
                         {
                         int ya = xb+1;
                         int za = xb-1;
                         Cursor note3 = mDbHelper.fetchNote(ya);
                         Cursor note4 = mDbHelper.fetchNote(za);
          double n =
 Double.valueOf(note3.getString(note3.getColumnIndexOrThrow(NotesDbAdapter.K 
 EY_VALUE)));
          double m =
 Double.valueOf(note4.getString(note4.getColumnIndexOrThrow(NotesDbAdapter.K 
 EY_VALUE)));
         double g = n/m;
         double da = g;
         mDbHelper.updateNote(da, false, false, false, false, false, false, 0,
 za, false, false);
         mDbHelper.deleteNote(xb);
         mDbHelper.deleteNote(xb);
         max -=2;
                         }
                 }
                 int xc = min-1;
                 while(xcmax)
                 {
                         xc++;
                         Cursor note2 = mDbHelper.fetchNote(xc);

 

[android-developers] Re: No text visible in edittext

2012-02-18 Thread Chris Mawata
The way you have written it that is what should happen -- you have a
loop
and you keep replacing the text with the substring. Generally in Jave
setXXX methods will replace the current value of a property with the
new value. Since this looks
like homework check the docs for a method that will add to the
string you currently have.

On Feb 18, 7:45 am, mohit verma mohit89m...@gmail.com wrote:
 Hi guys,
 I am having a string containing some words.
 Now in a for loop , i traverse the string and according to some condition i
 set the color and try to display text in this way:

 while(not reached string length)
 {

 if(condition1)  my_edittext.setColor(Color.RED);

 else if(condition2) my_edittext.setColor(Color.BLUE);

 and so on.

 }

 my_edittext.setText(substring);

 }

 Guys, i want my edittext to be filled-up by this colorfull string on
 activity startup(I mean without any actions yet performed on UI).

 When i do all this. in some string test cases , last word of my string
 appears in edittext but in other cases ... no string at all.

 Could someone please help me correct my way of implementation?

 Thanks in advance

 --
 Mohit

-- 
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] Please provide me the Mediarecorder documentation?

2012-02-18 Thread muhammad.ume...@hotmail.com
hi all,
   Please give me the Mediarecorder documentation or The report on
Mediarecorder. Please please i really need it.


Thanks and Regards,

umer

-- 
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] Shy are things not sending/recieving correctly from this database?

2012-02-18 Thread Jeresam515
None of the notes are created and as such I can't do anything with
them, help would be appreciated. TestCount always returns 0.

package com.real;


import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class NotesDbAdapter {

public static final String KEY_VALUE = x;
public static final String KEY_ISROOT = y;
public static final String KEY_ROWID = _id;
public static final String KEY_REALROWID = _ids;
public static final String KEY_ISPOWER = z;
public static final String KEY_POWERORROOTNUMBER = b;
public static final String KEY_ISDIVISOR = a;
public static final String KEY_ISMULTIPLIER = c;
public static final String KEY_ISADD = d;
public static final String KEY_ISSUBTRACT = e;
public static final String KEY_ISPS = f;
public static final String KEY_ISPE = g;
private static final String TAG = NotesDbAdapter;
private DatabaseHelper mDbHelper;
private SQLiteDatabase mDb;
private static final String DATABASE_NAME = data;
private static final String DATABASE_TABLE = notes;
private static final int DATABASE_VERSION =20;
private static final String DATABASE_CREATE =
   create table  +DATABASE_TABLE+  (
 +KEY_VALUE+  double,  
 +KEY_REALROWID+  integer,  
 +KEY_ROWID+  integer primary key autoincrement,  
+KEY_ISPOWER+  boolean,  
+KEY_ISDIVISOR+  boolean,  
+KEY_ISMULTIPLIER+  boolean,  
+KEY_ISADD+  boolean,  
+KEY_ISSUBTRACT+  boolean,  
+KEY_ISPS+  boolean,  
+KEY_ISPE+  boolean,  
+KEY_POWERORROOTNUMBER+  double,  
 +KEY_ISROOT+  boolean);;
private final Context mCtx;

private static class DatabaseHelper extends SQLiteOpenHelper {

DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}


@Override
public void onCreate(SQLiteDatabase db) {
try {
db.execSQL(DATABASE_CREATE);
} catch (Exception e) {
Log.e(dbAdapter, e.getMessage().toString());
}
}

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int
newVersion) {
Log.w(TAG, Upgrading database from version  + oldVersion
+  to 
+ newVersion + , which will destroy all old
data);
db.execSQL(DROP TABLE IF EXISTS notes);
onCreate(db);
}

}

public NotesDbAdapter(Context ctx) {
this.mCtx = ctx;
}

public NotesDbAdapter open() throws SQLException {
mDbHelper = new DatabaseHelper(mCtx);
mDb = mDbHelper.getWritableDatabase();
return this;
}

public void close() {
mDbHelper.close();
}


public void createNote(double value, boolean isroot, boolean
ispower, boolean ismultiply, boolean isdivisor, boolean add,
boolean issubtract, double roototpowerval, boolean
paranthaseesend, boolean paranthaseesstart) {
ContentValues initialValues = new ContentValues();
initialValues.put(KEY_VALUE, value);
initialValues.put(KEY_ISROOT, isroot);
initialValues.put(KEY_ISPOWER, ispower);
initialValues.put(KEY_ISMULTIPLIER, ismultiply);
initialValues.put(KEY_ISDIVISOR, isdivisor);
initialValues.put(KEY_ISADD, add);
initialValues.put(KEY_ISSUBTRACT, issubtract);
initialValues.put(KEY_POWERORROOTNUMBER, roototpowerval);
initialValues.put(KEY_ISPE, paranthaseesend);
initialValues.put(KEY_ISPS, paranthaseesstart);
  long r= mDb.insert(DATABASE_TABLE, null, initialValues);
  int a = testCount();
  ContentValues argsa = new ContentValues();
  argsa.put(KEY_VALUE, value);
  argsa.put(KEY_ISROOT, isroot);
  argsa.put(KEY_ISPOWER, ispower);
  argsa.put(KEY_ISMULTIPLIER, ismultiply);
  argsa.put(KEY_ISDIVISOR, isdivisor);
  argsa.put(KEY_ISADD, add);
  argsa.put(KEY_ISSUBTRACT, issubtract);
  argsa.put(KEY_POWERORROOTNUMBER, roototpowerval);
  argsa.put(KEY_REALROWID, a);
  argsa.put(KEY_ISPE, paranthaseesend);
  argsa.put(KEY_ISPS, paranthaseesstart);
  mDb.update(DATABASE_TABLE, argsa, KEY_ROWID + = + r, null);
}

public void deleteNote(long rowId) {
mDb.delete(DATABASE_TABLE, KEY_REALROWID + = + rowId, null);
int x = (int) rowId;
int y = testCount();
while(xy)
{x++;
Cursor note= fetchNote(x);
ContentValues argsan = new ContentValues();
argsan.put(KEY_VALUE,
note.getString(note.getColumnIndexOrThrow(NotesDbAdapter.KEY_VALUE)));
argsan.put(KEY_ISROOT,

[android-developers] Re: Same codebase, 2 apks, one free, another paid ?

2012-02-18 Thread androidmediadeveloper
Thanks for the feedback guys, Kostya, TreKing, Mark, each insightful !

As you rightly pointed out
The multiple apk approach suffers from the fact that the tablet app
cannot be positioned as a paid app. I guess if we use inapp billing,
this can be made to work, probably even preferable.

I am also exploring the possibility of the library project approach.
Seems doable.

Also, we got guidance from the google folks, they certainly prefer one
market listing, especially since the lines between what is considered
a tablet and a phone is thinning by the day. Some phones these days
have tablet screens and vice versa.

One other general issue is the apk size. If all these features are
offered as inapp pieces, the free app will have to ship with every
feature built in, but locked. This is both a security risk as well
as a size impediment, dont want to burden free users with tablet size
resources and layouts if we can avoid it.

Seems like there is no easy way out here, is there ? Does the multiple
apk approach only package resources that apply to the screen sizes
supported ?

Thanks!

On Feb 17, 3:12 pm, Kostya Vasilyev kmans...@gmail.com wrote:
 To build separate APKs while maintaining a more-or-less common code
 base, look into using an Android Library project:

 http://developer.android.com/guide/developing/projects/index.html

 Market lets you upload multiple APKs for the same package name,
 targeting distinct API levels or screen sizes. I'd recomment the latter,
 given that Android 4.0 supports both phone class and tablet class devices.

 All of those are presented to the user as a single application, so I
 don't think you'd be able to charge just for the tablet version - unless
 you used in-app billing.

 Alternatively, you could give the tablet version its own package name,
 essentially creating a separate paid app.

 -- K

 On 02/17/2012 11:55 PM, androidmediadeveloper wrote:







  We are trying to come up with a tablet optimized pro product that we
  only want shipped in the market as a paid app. We currently do have a
  free app in the market which is doing fairly well. I understand there
  are package naming restrictions and even if we build multiple apks
  (phone and tablet), we wont be able to host them separately. From a
  tech perspective we want to just maintain one codebase given both
  flavors are going to share a majority of the functionality.

  That leaves us with some preprocessor type step where prior to
  building the tablet apk, we create a new manifest, change the package
  name, change package names on all sources, and then produce separate
  apks. This is undesirable as is obvious.

  Any ideas here ? Any lessons learnt ? Any advice ?

-- 
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: Proxy settings for ICS over ethernet

2012-02-18 Thread Marco Pagliari
Have a look here http://www.android-proxy.com/, I'm trying to work on 
that.

-- 
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: proxy setting used by android browser??

2012-02-18 Thread Marco Pagliari
Have a look here http://www.android-proxy.com/. I'm working on that.

-- 
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: ProxyProperties?

2012-02-18 Thread Marco Pagliari
Have a look here http://www.android-proxy.com/. I'm working on that. 

-- 
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] Writing Proxy Settings in Settings.Secure

2012-02-18 Thread Marco Pagliari
Have a look here http://www.android-proxy.com/. I'm working on 
that. Please be patient. If you want to be involved the APL 
http://code.google.com/p/android-proxy-library/project is FOSS.

-- 
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: Proxy Authetication support in Android

2012-02-18 Thread Marco Pagliari
Have a look here http://www.android-proxy.com/. I'm working on 
that. Please be patient. If you want to be involved the APL 
http://code.google.com/p/android-proxy-library/project 
is FOSS. 

-- 
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: HTTP Proxy Connection

2012-02-18 Thread Marco Pagliari
Have a look here http://www.android-proxy.com/. I'm working on 
that. Please be patient. If you want to be involved the APL 
http://code.google.com/p/android-proxy-library/project 
is FOSS. 

-- 
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] ProxyProperties?

2012-02-18 Thread Kostya Vasilyev
ProxyProperties, along with a bunch of other classes and methods,
belongs to the new, improved WiFi / networking code that first
appeared in Android 3.0 and was revised in 4.0.

And yes, all of it is undocumented and marked with @hide.

On some firmwares (the original 3.2.1) those undocumented bits are the
only ones that work.

-- K

7 января 2012 г. 9:20 пользователь mattcoz matt...@gmail.com написал:
 I'm trying to receive the PROXY_CHANGE_ACTION broadcast and I'm having
 trouble.  Apparently there is a android.net.ProxyProperties object
 being passed in the extras bundle, but the SDK doesn't seem to include
 this class.  It is even mentioned in the javadoc for Proxy:

 The intent will have the following extra value:
 EXTRA_PROXY_INFO - The ProxyProperties for the proxy. Non-null, though
 if the proxy is undefined the host string will be empty.

 ProxyProperties just doesn't exist and the EXTRA_PROXY_INFO variable
 doesn't exist either.  What is going on here?

 --
 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] Re: Method oddly not working, help needed.

2012-02-18 Thread Lew
On Saturday, February 18, 2012 6:19:47 AM UTC-8, Jeresam515 wrote:

 Bump 

 
After only ten hours or so?  Really?

I thought about addressing your question, but your code is so badly 
formatted and unreadable
and crazy with antipatterns that there's no way I'm going near it.

Clean it up in accordance with the Java coding conventions, and don't do 
hand-waving like, 
Solve 1 is identical except it uses Solve 2 in the paranthasees 
[sic] portion.

Really you should make the smallest example that illustrates your problem 
and post that. 
Quite often doing so will give you the answer before you post.
Short, Self Contained, Correct (Compilable) Example
http://sscce.org/

And for Pete's sake post readable code!

-- 
Lew

-- 
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] test cases are in a different package

2012-02-18 Thread Lew
hongbosb wrote:

 If test cases are put in the same package, then release version will 
 contain test project. This isn't customer want to see. 


That's not true. You want the unit tests (it's important to distinguish 
what kind of test we're discussing!)
in the same package as the classes they test.

And no, that doesn't mean the release version will contain the test code. 
That's false. If you set up 
your project correctly it's false, of course. Anyone can screw up anything.

Put the test code in its own source tree, duh.

project/
  |
  | src/
  | 
  |--- test/

 

 And you should only test public interface. Because other module can only 
 use the method declared public. If 


Again, not true. More is exposed that 'public'; you also have to test 
'protected', and if the type is 
'Serializable' then you have to test the serialization/deserialization. It 
isn't the public interface that you must 
test, it's the exposed interface.

Package-private is different - you use package-private for methods that you 
want the test to override for 
greater control and mocking behavior.

There's no need to unit-test private methods (except as they affect 
serialization).
 

 you insist on testing method other than pubic, you can consider to use the 
 reflection of java [sic] to test even private method. But it violate common 
 sense of TDD.

 No.  No reflection needed or advisable.

Ray Tayek 写道:

 having the test cases in a different package make it hard to test methods 
 and classes with protected or the default visibility.


You don't test package-private, you use package-private to make testing 
possible.
 


 is there some reason why the test cases are put into a separate package?


No good one.
 


 placing them in the same package seems to work ok.

 am going to run into trouble by doing this?


Not if you do it right.

-- 
Lew

-- 
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: Please guide me how to send data(datastream, not files) from a PC to a real android phone via USB.

2012-02-18 Thread Lew
vvis wrote:

 Thx [sic] a lot, I will try reverse tethering via USB, and connect the 
 PC 
 and the mobile phone ag.. I think that is the most immediate way to 
 go. 


What does ag mean?

Let me remind you:
 

 Lew wrote: 
  There are problems with reverse tethering; tread carefully. 


Make sure you understand the Dark Side before you engage.

For one, it only works on rooted phones.

You didn't answer what I asked. Why is that?

-- 
Lew

-- 
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] AlarmManager - getAlarms or similar

2012-02-18 Thread Ted Scott
Is there a way to find out if I have an existing alarm waiting or do I 
have to create some sort of state variable and keep track of it?



--
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] Dynamic icon == widget?

2012-02-18 Thread Ted Scott
I'm running a service that monitors a metric and I want it to colorize 
the app icon dependent on the values.


Do I have to build a widget to interact with it or is there some way I 
can just replace the image?


--
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] Dynamic icon == widget?

2012-02-18 Thread Kostya Vasilyev
App icons (shortcuts) are drawn by *a* launcher, and there is no way
to control / modify their appearance.

So yes, if you need to display dynamic info, you build a widget.

-- K

18 февраля 2012 г. 22:55 пользователь Ted Scott t...@hootinholler.com написал:
 I'm running a service that monitors a metric and I want it to colorize the
 app icon dependent on the values.

 Do I have to build a widget to interact with it or is there some way I can
 just replace the image?

 --
 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] AlarmManager - getAlarms or similar

2012-02-18 Thread Kostya Vasilyev
Regrettably, no - you will need to keep track of alarms in your code,
including saving this data to persistent storage in case the process
gets killed / restarted.

-- K

18 февраля 2012 г. 22:52 пользователь Ted Scott t...@hootinholler.com написал:
 Is there a way to find out if I have an existing alarm waiting or do I have
 to create some sort of state variable and keep track of it?


 --
 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] HTTP Post Json to IIS Service

2012-02-18 Thread Mark Turkel
Hi All,

I have an IIS service (.net) that I'm obviously not passing the
correct json message to.  I have tried many of the examples I have
found on the web, but they all seem to point to PHP services.  I'm
doing everything as everyone else is...and the json string looks as it
should.  Can someone please let me know the big secret? :)  This
should not take 2 days of my life to figure out... LOL!

Thank in advance for your help!
Mark Turkel
http://www.PalmBeachSoftware.com


Here's what I'm trying to post:

String baseurlString = http://MYSERVER.com/Service/SurfReport;;


   JSONObject json = new JSONObject();
try {
json.put(UserID, 
----0001);
json.put(City, Boynton Beach);
json.put(State, FL);
json.put(Country, USA);
json.put(Longitude, -80.06643);
json.put(Latitude, 26.525359);
json.put(RptDate, 02/17/2012);
json.put(WaveHeight, 3);
json.put(ConditionID, 1);
json.put(Comments, Go get wet!);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}





public void testPost(String baseurlString, final JSONObject json) {
try {


HttpParams httpParams = new BasicHttpParams();
HttpConnectionParams.setConnectionTimeout(httpParams,
TIMEOUT_MILLISEC);
HttpConnectionParams.setSoTimeout(httpParams,
TIMEOUT_MILLISEC);
HttpClient client = new DefaultHttpClient(httpParams);

HttpPost request = new HttpPost(baseurlString);
request.addHeader(Content-Type, application/json;
charset=utf-8);

request.setEntity(new
ByteArrayEntity(json.toString().getBytes(UTF8)));
request.setHeader(json, json.toString());

HttpResponse response = client.execute(request);
HttpEntity entity = response.getEntity();

// If the response does not enclose an entity, there
is no need
if (entity != null) {
InputStream instream = entity.getContent();

String result =
RestClient.convertStreamToString(instream);
Log.i(MARK,RESULT from server:  + result);
Log.i(MARK, sending surf report to: + baseurlString +
:   + request.getRequestLine()  + json.toString());

}
} catch (Throwable t) {
Toast.makeText(this, Request failed:  + t.toString(),
Toast.LENGTH_LONG).show();
}
}

-- 
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: sound player

2012-02-18 Thread Mark Turkel
Here's code that I am using repeatedly in several apps... hope this
helps!  :)

final class PlaySound {
public static boolean playing=false;

private static HashSetMediaPlayer mpSet = new
HashSetMediaPlayer();

static void play(Context context, int resId) {
playing=true;
MediaPlayer mp = MediaPlayer.create(context, resId);
mp.setOnCompletionListener(new
MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
mpSet.remove(mp);
mp.stop();
mp.release();
playing=false;
}
});
mpSet.add(mp);
mp.start();
}

static void stop() {
for (MediaPlayer mp : mpSet) {
if (mp != null) {
mp.stop();
mp.release();
playing=false;
}
}
mpSet.clear();
}
}

-- 
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: Same codebase, 2 apks, one free, another paid ?

2012-02-18 Thread Kostya Vasilyev
18 февраля 2012 г. 19:08 пользователь androidmediadeveloper
kamathaj...@gmail.com написал:
 [snip]
 One other general issue is the apk size. If all these features are
 offered as inapp pieces, the free app will have to ship with every
 feature built in, but locked. This is both a security risk as well
 as a size impediment, dont want to burden free users with tablet size
 resources and layouts if we can avoid it.

According to this page:

http://developer.android.com/guide/market/publishing/multiple-apks.html#SupportedFilters

Market lets you upload one .APK for, let's say, small and normal
screens, and another one for large and x-large.

The same page cautions:

Unless your APK file exceeds the Android Market size limit of 50MB,
supporting multiple screens should always be done with a single APK.

I have no reason to question this recommendation. Most of the phone
vs. tablet overhead should be in the form of layout resources, and
some code structure. Images, on the other hand, vary with screen
density, and there is already a full range of densities out there in
the normal screen size bucket, typical of a phone class device.

-- Kostya



 Seems like there is no easy way out here, is there ? Does the multiple
 apk approach only package resources that apply to the screen sizes
 supported ?

-- 
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] discovering string resources at run-time

2012-02-18 Thread Ray Tayek
hi, i am making an app that has a bunch of questions multiple choice 
answers. i have these in the strings.xml resources file.


my app does not know how many questions or answers there is, so it 
wants  to discover this at runtime. i.e. i want to look for strings 
or string arrays that look like question1 or question1Answer2.


i have tried to introspect the stuff in R using the code below. this 
code finds the stuff in R just fine.


i was warned away from this approach (see 
https://groups.google.com/forum/#!topic/android-developers/rs_l8I4nNtg).


i would like to avoid parsing the xml.

and this seems to work.

is this a reasonable ting to do?

or would i be better off, just keeping my data in resource bundles or 
properties file.


thanks

static MapString,Object fields(Class? c){
MapString,Object map=new LinkedHashMapString,Object();
Field[] fields;
fields = c.getDeclaredFields();
System.out.println(getting fields for: +c.getName());
for (Field field : fields)
try {
Object object=field.get(null);
System.out.println( +field.getName()+=+object);
map.put(field.getName(),field.get(null));
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
System.out.println(map);
return map;
}
static void fields() {
MapString, Object layout = Jata0Activity.fields(R.layout.class);
System.out.println(layout:  + layout);
MapString, Object id = Jata0Activity.fields(R.id.class);
System.out.println(id:  + id);
MapString, Object string = Jata0Activity.fields(R.string.class);
System.out.println(string:  + string);
MapString, Object array = Jata0Activity.fields(R.array.class);
System.out.println(array:  + array);
}



---
co-chair http://ocjug.org/

--
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] test cases are in a different package

2012-02-18 Thread Ray Tayek

At 10:43 AM 2/18/2012, you wrote:

...
That's not true. You want the unit tests (it's 
important to distinguish what kind of test we're discussing!)

in the same package as the classes they test.


yes.


...
Put the test code in its own source tree, duh.

project/
  |
  | src/
  |
  |--- test/


my core app is in a separate package. unit tests 
are in a separate source folder as described above.



Ray Tayek å†™é “ï¼š
... is there some reason why the test cases are put into a separate package?

No good one.

placing them in the same package seems to work ok.

am going to run into trouble by doing this?


Not if you do it right.


my android app is in the same package , but is in 
a different project (from the core app).


the android tests are in the same package, but it 
is in a different project (from the android app).


project: coreApp/
src/com.me.app
tst/com.me.app

project: androidApp/
src/com.me.app

project androidTest/
src/com.me.app
class AndroidAppTestCase extends 
ActivityInstrumentationTestCase2AndroidAppActivity



thanks


---
co-chair http://ocjug.org/

--
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: Help with Maps problem on emulator

2012-02-18 Thread Gene
Thanks.  It finally started working when I deleted http:// from the
Proxy entry in the emulated Android device Access Point proxy
settings.  When I looked back at my old notes, this is how I had
gotten it working originally.  I had created a new virtual device and
added the http:// by mistake.

In my work environment running any software with a listener port (like
a proxy) is a big problem.

On Feb 16, 11:08 pm, lbendlin l...@bendlin.us wrote:
 you can run your own proxy on your host computer and log the traffic. as
 far as I remember the map tiles are served via standard http.

-- 
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] hasSystemFeatures sometimes hides Wi-Fi

2012-02-18 Thread RLScott
What is PackageManager.hasSystemFeatures(PackageManager.FEATURE_WIFI)
supposed to return if Wi-Fi exists on the device but is currently
turned off?  On the devices I have tested it correctly reports that
the device does indeed have Wi-Fi.  But many of my customers' devices
are reporting no Wi-Fi.  So many, in fact, that I am beginning to
suspect that the implementation of this function might be device
dependent to the extent that some devices are returning false when
they have Wi-Fi but it is turned off.  Anybody know if this is the
case?

-- 
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: Shy are things not sending/recieving correctly from this database?

2012-02-18 Thread Jeresam515
bump

-- 
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: Help! Monkeyrunner Press and Touch event

2012-02-18 Thread Diego Torres Milano
I couldn't reproduce the problem with either 2.3 and 4.0 emulators.
Perhaps there's something in the part you removed from your code.
And move the line
   HV = D.getHierarchyViewer() 
outside of the loop.

-- 
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] Method oddly not working, help needed.

2012-02-18 Thread TreKing
On Fri, Feb 17, 2012 at 10:09 PM, Jeresam515 jeremyschiff...@gmail.comwrote:

 Here is my method for part of a calculator app, could someone take a look
 and see why it isnt working?


It might help if you explain what it isn't working means.

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

-- 
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] Nexus S

2012-02-18 Thread TreKing
On Sat, Feb 18, 2012 at 8:02 AM, Satyajit Sarangi writetosatya...@gmail.com
 wrote:

 Does anyone have  a Google Nexus S for sale in India?


http://www.craigslist.org/about/sites#ASIA
http://www.ebay.com/


 Its rather urgent


Have you considered going to a store?

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

-- 
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: sound player

2012-02-18 Thread Felix Long
you need call mp.prepare before mp.start
在 2012-2-19 上午3:13,Mark Turkel pbsdm...@gmail.com写道:

 Here's code that I am using repeatedly in several apps... hope this
 helps!  :)

 final class PlaySound {
public static boolean playing=false;

private static HashSetMediaPlayer mpSet = new
 HashSetMediaPlayer();

static void play(Context context, int resId) {
playing=true;
MediaPlayer mp = MediaPlayer.create(context, resId);
mp.setOnCompletionListener(new
 MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
mpSet.remove(mp);
mp.stop();
mp.release();
playing=false;
}
});
mpSet.add(mp);
mp.start();
}

static void stop() {
for (MediaPlayer mp : mpSet) {
if (mp != null) {
mp.stop();
mp.release();
playing=false;
}
}
mpSet.clear();
}
 }

 --
 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] Get call duration.

2012-02-18 Thread fei ji
You can use the class called SimpleDateFormat to format the output of time.
6258 is actually counted in millis. So you have to change the millis to
seconds and output.


On Wed, Feb 15, 2012 at 3:05 PM, Jagruti Sangani 
jagruti.sang...@inextrix.com wrote:

 Hello,
 Iam using the below code and output will give as below.
 Cursor c =

 context.getContentResolver().query(android.provider.CallLog.Calls.CONTENT_URI,null,
 null, null,android.provider.CallLog.Calls.DATE +  DESC);
int total=c.getCount();
int numberColumn =
 c.getColumnIndex(android.provider.CallLog.Calls.NUMBER);
int dateColumn =
 c.getColumnIndex(android.provider.CallLog.Calls.DATE);

  // type can be: Incoming, Outgoing or Missed
int typeColumn =
 c.getColumnIndex(android.provider.CallLog.Calls.TYPE);
int DurationColumn =
 c.getColumnIndex(android.provider.CallLog.Calls.DURATION);

 if(c.moveToPosition(0)){
// c.move(1);
String callerPhoneNumber = c.getString(numberColumn);
String callerPhoneDate = c.getString(dateColumn);
String TYeor = c.getString(typeColumn);
String Duration = c.getString(DurationColumn);
Toast.makeText(WalkieTalkieActivity.this,type column-
 +TYeor ,Toast.LENGTH_SHORT).show();
Toast.makeText(WalkieTalkieActivity.this,duration-
 +Duration ,Toast.LENGTH_SHORT).show();
Toast.makeText(WalkieTalkieActivity.this,phone number-
 +callerPhoneNumber ,Toast.LENGTH_SHORT).show();
  }


 output:

 type:-2
 duration-6258
 phonenumber:-1552175049

 But what is it that i dont know so how can i get correct output please
 tell me.If any other way then also tell me.

 --
 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] How to get total call duration of last call as well as all call duration

2012-02-18 Thread fei ji
Have you ever move cursor to next?
Since the orginal cursor is reference to -1, so if you get the data
directly before moving one step next, it will always give this error.

I found there is
getLastOutgoingCallhttps://developer.android.com/reference/android/provider/CallLog.Calls.html#getLastOutgoingCall(android.content.Context).
I think you can use this method to get the last call number. And use this
number to query duration .

On Wed, Feb 15, 2012 at 2:22 PM, Jagruti Sangani 
jagruti.sang...@inextrix.com wrote:

 Hello,
 I want to get the total call duration.I am using the posted code but
 in that I am getting something error like cursor index -1 requested
 with total records 10.How can i  get the call duration of last
 call.Basically i want the timer system like when call will start then
 timer will start and when call end then timer will stop.But that is
 not occur with me so i am trying to get total call duration.If anybody
 know then plz reply me.

 --
 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: Proxy Authetication support in Android

2012-02-18 Thread Kristopher Micinski
This project contains a few hundred lines of source so far... Was
it..., really worth spamming the list *five times* with the exact same
thing to advertise it?

kris

On Sat, Feb 18, 2012 at 10:54 AM, Marco Pagliari pis...@gmail.com wrote:
 Have a look here. I'm working on that. Please be patient. If you want to be
 involved the APL project is FOSS.

 --
 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] Re: Get the PCM data of the songs currently playing in the android phone

2012-02-18 Thread Doug
On Feb 16, 11:10 pm, dev_alb albintha...@gmail.com wrote:
 I am planning to fetch the decoded PCM data of a currently playing
 song in the android phone. Can we do it from the application layer?

No.

 Meanwhile it would be really helpful if any one of you could suggest
 me an audio decoder in java.

Try Google.  I don't think you will find much that is not JavaSound
native, though.

Doug

-- 
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: Recognizing Motion Event

2012-02-18 Thread kumar raja
Please somebody help me with this.

On 19 February 2012 11:12, kumar raja rajkumar.cs...@gmail.com wrote:

 i have an application which has the following layout.

 a b c d e
 f g h i j

 and one string,.say str

 and i am implementing ontouchlistener and using ontouch(View V,MotionEvent
 M)

 my task is to achieve when a button  say 'c' is touched the str set to
  down c. it is done by using ACTION_DOWN recognition .

 But after that  before the ACTION_UP event , if the user slides to 'd'
 then it should be recognized. and str should set to b down.

 i am not getting by what methods or events i can achieve this. whether i
 need to use keyevent, hoverevents or touchevents

 i am not getting the answer . and i am in a really need of it. i have
 posted my code. SO someone please give me an idea of how to solve this.


 for (int i = 0; i  mybtn.length; i++)

   {

 String btnid = btn + i;

 int resid = getResources().getIdentifier(btnid, id,

 getPackageName());

 mybtn[i] = (Button) findViewById(resid);

 mybtn[i].setOnTouchListener(this);


}


 public boolean onTouch(View v, MotionEvent event)
 {

 // TODO Auto-generated method stub

 String s = null;

 s = ((Button) v).getText().toString().trim();


 switch (event.getAction()) {

 // case MotionEvent.ACTION_MOVE:
 // Do some stuff
 // et.setText(move android+s, TextView.BufferType.EDITABLE );

 // break;

 case MotionEvent.ACTION_DOWN:

 current = Integer.valueOf(s);

 et.setText(down android + s, TextView.BufferType.EDITABLE);

 // Do some stuff
 break;
 case MotionEvent.ACTION_UP:

 et.setText(up android + s, TextView.BufferType.EDITABLE);

 break;
 case MotionEvent.ACTION_MOVE:

 if (current != Integer.valueOf(s)) {

 current = Integer.valueOf(s);

 }
 break;

 }

 return false;
 }

 }



 --
 Regards
 Kumar Raja
 M.Tech(SIT)
 IIT Kharagpur,
 10it60...@iitkgp.ac.in





-- 
Regards
Kumar Raja
M.Tech(SIT)
IIT Kharagpur,
10it60...@iitkgp.ac.in

-- 
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] Parse JSON using GSON library

2012-02-18 Thread Passion Android
this is my JSON --  {\id\:12,\name\:12,\status\:\ok\,
\volumes\:[{\id\:17592,\name\:\root\,\status\:\ok\}]}
i want to parse it by using GSON how to do it just give me the demo.If
u provide me the sample code it will be easier.
Thanks
Rickky Litao

-- 
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] Parse JSON using GSON library

2012-02-18 Thread Kristopher Micinski
http://lmgtfy.com/?q=gson+example

kris

On Sun, Feb 19, 2012 at 2:16 AM, Passion Android
passion4andr...@gmail.com wrote:
 this is my JSON     --      {\id\:12,\name\:12,\status\:\ok\,
 \volumes\:[{\id\:17592,\name\:\root\,\status\:\ok\}]}
 i want to parse it by using GSON how to do it just give me the demo.If
 u provide me the sample code it will be easier.
 Thanks
 Rickky Litao

 --
 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