Re: [android-beginners] Re: How often does an activity run?

2010-04-20 Thread Daniel Favela
Well, this seems like a good exercise to test my learning and reading as a
newbie in the Android scene.

If I'm understanding BobG correctly, he means that the calls to onDraw
depend entirely on your application.  Your *Hello World!* sample renders the
text once and never has to render anything again -- the view stays put as
you left it.  It's a callback: when something happens (like user input),
then onDraw() might be called if something new has to be drawn.

A game, for example, might process game logic at each frame.  This results
in onDraw() being called for each frame, since game logic might place a game
object in a position different from that it was in during the last frame.

Hello World, as mentioned, doesn't need to be updated in that way.  That's
why onDraw() is not called anymore.

With regards to the zombie sentiment, onDraw() does not actually take up
any more memory than any other function might take; it is called when
needed, I suspect, much like onCreate(), onStart(), onResume, onDestroy() do
(these are methods involved in an activity's life cycle; check out the
Android Application fundamentals page
herehttp://developer.android.com/guide/topics/fundamentals.html#lcycles
to
see where I'm pulling these potentially wrong statements from).  From what
I've read, Android does things in a very, very, very modular manner;
everything is there and safe until it's needed.

I'm guessing that if you were to press Home or Back while *Hello
World!*was running, then you brought it back to the foreground, it
would call
onDraw() again.

If I'm wrong in anything I've said, please correct me!  I hope that helps.

-Danny

On Mon, Apr 19, 2010 at 7:27 AM, BobG bobgard...@aol.com wrote:

 On Apr 19, 9:08 am, ~ TreKing treking...@gmail.com wrote:
  I don't know what you're asking. Activities don't really run like
 threads
  that have a definite function that gets executed to do work. They have
  functions that are invoked in response to system events (onCreate,
 onPause,
  onConfigurationChanged, etc).
 =
 Here is my 'model' that compares an embedded program to an android
 program:
 embedded program: main gets called by os, main calls initstuff(),
 falls into a while(1) loop that calls inputs(), process() and
 outputs() forever. The os can kill it if it has to. In the android
 program, the onCreate is the init, the os scheduler is the while(1)
 loop, and the onSensorChanged events are like the input and process
 functions, and the onDraw is like the output function. Sort of. Does
 this model make sense to anyone else? Can it be explained more clearly
 by another model?

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

 NEW! Try asking and tagging your question on Stack Overflow at
 http://stackoverflow.com/questions/tagged/android

 To unsubscribe from this group, send email to
 android-beginners+unsubscr...@googlegroups.comandroid-beginners%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-beginners?hl=en


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

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


Re: [android-beginners] Screen height?

2010-04-20 Thread Justin Anderson
May I ask why you need something like that?

--
There are only 10 types of people in the world...
Those who know binary and those who don't.
--


On Mon, Apr 19, 2010 at 9:52 PM, BobG bobgard...@aol.com wrote:

 What's the name of the function that returns the screen height minus
 the title bar and status bar? Thanks... I've really been looking for a
 while...

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

 NEW! Try asking and tagging your question on Stack Overflow at
 http://stackoverflow.com/questions/tagged/android

 To unsubscribe from this group, send email to
 android-beginners+unsubscr...@googlegroups.comandroid-beginners%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-beginners?hl=en


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

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] How to Bind data to list?

2010-04-20 Thread Prashant Shelar
Hello,

I have a two string arrays:
String[] keys={A,B,C,D,E};
String[] values={655,466,627,168,569};

Now i wanted to display a list:

A

B

C

D

E


When user clicks on any of above list item i wanted to show a values
associated with it.

That means i need to bind values with each corresponding list item.

I searched this group but not getting exact right direction or may be
am thing in wrong direction.

Thanks,
Prashant.

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

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] how to install steel browser

2010-04-20 Thread apoorvi
i want to install steel browser in my android emulator .Can u guys
please help me with the steps involved

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

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


Re: [android-beginners] How to Bind data to list?

2010-04-20 Thread Justin Anderson
You are going to need to provide a little more information if you want a
real answer.  I'm assuming you are using a ListActivity?  If so, there is
a method called onListItemClick that passes a position parameter.

Assuming that the items are displayed in the list in the same order as the
array you could then just do something like the following to get the correct
value:

public void 
onListItemClickhttp://developer.android.com/reference/android/app/ListActivity.html#onListItemClick%28android.widget.ListView,%20android.view.View,%20int,%20long%29
(ListViewhttp://developer.android.com/reference/android/widget/ListView.htmll,
View http://developer.android.com/reference/android/view/View.html v, int
position, long id)
{
String val = values[position];
//Display the val somehow
}

And, really, it took me about 10 seconds to look in the docs and see that
ListActivity has this method.  Not sure if you had done any searching or
anything to begin with (and if you have you can ignore this slight rebuke)
but I would highly recommend doing at least a little homework and try to
figure out the answer yourself before posting in the future... Some people
can get pretty mean on here (admittedly I used to be one of them but I'm
trying to be a little nicer...)

Hope that helps for now,
Justin

--
There are only 10 types of people in the world...
Those who know binary and those who don't.
--


On Tue, Apr 20, 2010 at 12:25 AM, Prashant Shelar shelar...@gmail.comwrote:

 Hello,

 I have a two string arrays:
 String[] keys={A,B,C,D,E};
 String[] values={655,466,627,168,569};

 Now i wanted to display a list:
 
A
 
B
 
C
 
D
 
E
 

 When user clicks on any of above list item i wanted to show a values
 associated with it.

 That means i need to bind values with each corresponding list item.

 I searched this group but not getting exact right direction or may be
 am thing in wrong direction.

 Thanks,
 Prashant.

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

 NEW! Try asking and tagging your question on Stack Overflow at
 http://stackoverflow.com/questions/tagged/android

 To unsubscribe from this group, send email to
 android-beginners+unsubscr...@googlegroups.comandroid-beginners%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-beginners?hl=en


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

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


Re: [android-beginners] how to install steel browser

2010-04-20 Thread nubh bhargava
Hi,

I dont know much what are you speaking of. Is it some sort of application?
Check for this link I hope you get something useful here

http://developer.android.com/guide/developing/tools/emulator.html

There are sublinks for your use.

Thanks  Regards
NUBH

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

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


Re: [android-beginners] Using Methods in a Service from an Activity

2010-04-20 Thread Tom F M White
Ok, I've found the problem, for anyone else having trouble. In the 
tutorial, onBind() returns null, I created a MediaBinder class within 
MediaService, that implemented my MediaInterface, calling the relevant 
methods in MediaService. This works nicely.


On 19/04/2010 21:43, Mark Murphy wrote:

Tom F M White wrote:
   

I'm calling start a relatively long time later, several seconds. Do I
need to call onServiceConnected() myself?
 

No, it should be called shortly after you call bindService(). This
suggests that your bindService() call is failing for some reason (e.g.,
your service is not registered in your manifest).

Here is a sample project from one of my books showing the use of
bindService():

http://github.com/commonsguy/cw-android/tree/master/Service/WeatherPlus/

   


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

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


Re: [android-beginners] Screen height?

2010-04-20 Thread murali raju
WindowManager wm =
(WindowManager)
getSystemService(Context.WINDOW_SERVICE);
   Display dsp = wm.getDefaultDisplay();


On Tue, Apr 20, 2010 at 11:46 AM, Justin Anderson
janderson@gmail.comwrote:

 May I ask why you need something like that?


 --
 There are only 10 types of people in the world...
 Those who know binary and those who don't.
 --


 On Mon, Apr 19, 2010 at 9:52 PM, BobG bobgard...@aol.com wrote:

 What's the name of the function that returns the screen height minus
 the title bar and status bar? Thanks... I've really been looking for a
 while...

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

 NEW! Try asking and tagging your question on Stack Overflow at
 http://stackoverflow.com/questions/tagged/android

 To unsubscribe from this group, send email to
 android-beginners+unsubscr...@googlegroups.comandroid-beginners%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-beginners?hl=en


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

 NEW! Try asking and tagging your question on Stack Overflow at
 http://stackoverflow.com/questions/tagged/android

 To unsubscribe from this group, send email to
 android-beginners+unsubscr...@googlegroups.comandroid-beginners%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-beginners?hl=en


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

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


Re: [android-beginners] Re: Custom Themes

2010-04-20 Thread Chirayu Dalwadi
Thanks all  :)

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

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


Re: [android-beginners] how to install steel browser

2010-04-20 Thread Mark Murphy
apoorvi wrote:
 i want to install steel browser in my android emulator .Can u guys
 please help me with the steps involved

http://www.kolbysoft.com/downloads.html

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | 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 Beginners group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Re: grow or shrink view

2010-04-20 Thread satish bhoyar
Guys anybody knows this ... hw to solve this ...?

please help ..

thanks

On Mon, Apr 19, 2010 at 6:59 PM, satish bhoyar getsatonl...@gmail.comwrote:

 Hi,

 I have one problem... like i want my view to grow or shrink in one
 direction like curtains. What animation i can use for this? is this scalling
 or wht is it ?

 please tell me

 thanks..



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

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Re: Refreshing GUI listview

2010-04-20 Thread tony obrien
It looks like what you really need is the ListActivity's OnResume(),
etc.


On Apr 19, 1:54 pm, Patrick Nako nako...@gmail.com wrote:
 Hello everyone, i'm in the process of creating a application manager/
 killer for my high school senior project. Unfortunately i'm running
 into the issue of my view not refreshing graphically with my updated
 list. The application killing works but the list refreshing after
 killing the application does not. My application seems to refresh the
 view when you hit the back button and re-opening my application but
 hitting the home button and re-opening my application doesn't.

 Note - All experimenting has been done on the emulator and not on my
 Droid yet.

 My Code:

 public class NTaskManager extends ListActivity implements
 DialogInterface.OnClickListener{

         //Recreation of RunningAppProcessInfo class that is able to return
 its process name
         public class NRunningAppProcessInfo extends
 ActivityManager.RunningAppProcessInfo{

                 public  
 NRunningAppProcessInfo(ActivityManager.RunningAppProcessInfo
 n){
                         this.importance = n.importance;
                         this.importanceReasonCode = n.importanceReasonCode;
                         this.importanceReasonComponent = 
 n.importanceReasonComponent;
                         this.importanceReasonPid = n.importanceReasonPid;
                         this.lru = n.lru;
                         this.pid = n.pid;
                         this.pkgList = n.pkgList;
                         this.processName = n.processName;
                         this.uid = n.uid;
                 }
                 public String toString(){
                         return this.processName;
                 }
         }

         //Pop up dialog box when user clicks on an item on the list
         public void onClick(DialogInterface dialog, int which){
                 String f = String.valueOf(Process.myUid());

                 if (which == AlertDialog.BUTTON_POSITIVE){
                         searchAndKillTask();
                 }

                 else if(which == AlertDialog.BUTTON_NEGATIVE){
                         Toast.makeText(this, f, Toast.LENGTH_LONG).show();
                 }
         }

         //Declare variables and lists
         boolean hasNextCheck = true;
         private static final int REFRESH = 0;
         boolean isPrevious;
         boolean isNext;
         String taskToBeKilled = ;

         LinkedListNRunningAppProcessInfo processes; //List that will hold
 object names
         ListActivityManager.RunningAppProcessInfo x; //List containing
 objects that hold application information
         ActivityManager z; //Manages applications such as ending them
         ListIteratorActivityManager.RunningAppProcessInfo i; //List
 iterator
         ArrayAdapterNRunningAppProcessInfo processliststring;
         ListView lv;
         AlertDialog.Builder adb; //Alert dialog box builder for clicking of
 an item

     /** Called when the activity is first created. */
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);

         //Assign the linked list
         processes = new LinkedListNRunningAppProcessInfo();

         //Assign the activity manager
         z = (ActivityManager)getSystemService(ACTIVITY_SERVICE);

         //Give the list application information
         x = z.getRunningAppProcesses();

         //Add processes to linked list for list adapter and show it
         this.refreshList();

         //Create an alert dialog box...
         adb = new AlertDialog.Builder(this);

         //...If yes kill task...
         adb.setPositiveButton(Yes, this);

         //...If no do nothing
         adb.setNegativeButton(No, this);

         //When an item on the list is pressed
         lv.setOnItemClickListener(new OnItemClickListener() {
           public void onItemClick(AdapterView? parent, View view,
               int position, long id) {

                   //Set text to ask if they want to kill the task
                   adb.setMessage(Kill Task +
 ((TextView)view).getText().toString() + ?);

                   taskToBeKilled = ((TextView)view).getText().toString();

                   //Show the alert dialog box
                   adb.show();
                   refreshList();

           }
         });

     }

     private void refreshList(){
         //Clear the list to start fresh
         processes.clear();

         //Refresh the list iterator
         i = x.listIterator();

         //Loop...
         do{
                 //Check if there is something next on the list
             isNext = i.hasNext();

             //If there is...
             if(isNext == true){
                 //Add the process to the process list
                 processes.add(new NRunningAppProcessInfo(i.next()));
             }
         }while(isNext == true);//...while there is something next on
 the list

      

[android-beginners] Images Reused in a ListView

2010-04-20 Thread Tom F M White
I've made a custom ListAdaptor, with associated View, that displays an 
icon on the left of each list item, with three lines of text to the 
right. In MyView.onCreate(), the icons are populated using 
imageView.setImageDrawable(Drawable.createFromStream(URL)); each item on 
the list is it's own object, so each of these is done individually for 
each list item. However when viewing the list, the first few items 
display correctly, but as you scroll down the list, those images that 
were not visible initially are replaced with the same images used in the 
top few items, so 4/5 images end up reused for the entire list. The text 
for each list item is correct. What is going wrong?


Tom

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

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


Re: [android-beginners] Images Reused in a ListView

2010-04-20 Thread Martin Obreshkov
Can you paste some code

On Tue, Apr 20, 2010 at 5:19 PM, Tom F M White fred...@gmail.com wrote:

 I've made a custom ListAdaptor, with associated View, that displays an icon
 on the left of each list item, with three lines of text to the right. In
 MyView.onCreate(), the icons are populated using
 imageView.setImageDrawable(Drawable.createFromStream(URL)); each item on the
 list is it's own object, so each of these is done individually for each list
 item. However when viewing the list, the first few items display correctly,
 but as you scroll down the list, those images that were not visible
 initially are replaced with the same images used in the top few items, so
 4/5 images end up reused for the entire list. The text for each list item is
 correct. What is going wrong?

 Tom

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

 NEW! Try asking and tagging your question on Stack Overflow at
 http://stackoverflow.com/questions/tagged/android

 To unsubscribe from this group, send email to
 android-beginners+unsubscr...@googlegroups.comandroid-beginners%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-beginners?hl=en




-- 
When I raise my flashing sword, and my hand takes hold on judgment, I will
take vengeance upon mine enemies, and I will repay those who haze me. Oh,
Lord, raise me to Thy right hand and count me among Thy saints.

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

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


Re: [android-beginners] Images Reused in a ListView

2010-04-20 Thread Tom F M White
TripleText is just an object for storing 4 strings, 3 for the text, 1 
for the image URL. Rest of the code follows, sorry it's quite long...


TripleTextView:

public class TripleTextView extends LinearLayout {

private TextView mText1;
private TextView mText2;
private TextView mText3;
private String imageURL;
private ImageView image;
private Drawable imageDrawable;
public TripleTextView(Context context, TripleText tt) {
super(context);

this.setOrientation(HORIZONTAL);

//add image
imageURL = tt.getImageURL();
try {
Log.v(TTV,Loading Drawable from: +imageURL);
imageDrawable = Drawable.createFromStream(new 
URL(imageURL).openStream(), src);


Log.v(TTV,Image created ok);
} catch (MalformedURLException e) {
Log.v(TTV,Malformed URL);
} catch (IOException e) {
Log.v(TTV,IO Exception);
}
image = new ImageView(context);
image.setImageDrawable(imageDrawable);

addView(image,  new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
LinearLayout subLayout = new LinearLayout(context);
subLayout.setOrientation(VERTICAL);

mText1 = new TextView(context);
mText1.setText(tt.getText1());

subLayout.addView(mText1,  new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));

mText2 = new TextView(context);
mText2.setText(tt.getText2());

subLayout.addView(mText2, new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
mText3 = new TextView(context);
mText3.setText(tt.getText3());

subLayout.addView(mText3, new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
addView(subLayout, new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));

}

public void setText1(String words) {
mText1.setText(words);
}

public void setText2(String words) {
mText2.setText(words);
}
public void setText3(String words) {
mText3.setText(words);
}

public void setImageURL(String imageURL) {
this.imageURL = imageURL;
}
}

TripleListAdapter:

public class TripleListAdapter extends BaseAdapter {

 private Context mContext;

 private ListTripleText mItems = new ArrayListTripleText();

 public TripleListAdapter(Context context) {
  mContext = context;
 }

 public void addItem(TripleText it) { mItems.add(it); }

 public void setListItems(ListTripleText lit) { mItems = lit; }

 public int getCount() { return mItems.size(); }

 public Object getItem(int position) { return mItems.get(position); }

 public boolean areAllItemsSelectable() { return false; }

 public boolean isSelectable(int position) {
  try{
   return mItems.get(position).isSelectable();
  }catch (IndexOutOfBoundsException aioobe){
   return false;
  }
 }

 public long getItemId(int position) {
  return position;
 }
 public View getView(int position, View convertView, ViewGroup 
parent) {

 TripleTextView ttv;
  if (convertView == null) {
   ttv = new TripleTextView(mContext, mItems.get(position));
  } else {
  ttv = (TripleTextView) convertView;
  ttv.setText1(mItems.get(position).getText1());
  ttv.setText2(mItems.get(position).getText2());
  ttv.setText3(mItems.get(position).getText3());
  ttv.setImageURL(mItems.get(position).getImageURL());
  }
  return ttv;
 }
}

On 20/04/2010 15:25, Martin Obreshkov wrote:

Can you paste some code

On Tue, Apr 20, 2010 at 5:19 PM, Tom F M White fred...@gmail.com 
mailto:fred...@gmail.com wrote:


I've made a custom ListAdaptor, with associated View, that
displays an icon on the left of each list item, with three lines
of text to the right. In MyView.onCreate(), the icons are
populated using
imageView.setImageDrawable(Drawable.createFromStream(URL)); each
item on the list is it's own object, so each of these is done
individually for each list item. However when viewing the list,
the first few items display correctly, but as you scroll down the
list, those images that were not visible initially are replaced
with the same images used in the top few items, so 4/5 images end
up reused for the entire list. The text for each list item is
correct. What is going wrong?

Tom

-- 
You received this message because you are subscribed to the Google

Groups Android Beginners group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To 

Re: [android-beginners] Images Reused in a ListView

2010-04-20 Thread Mark Murphy
Tom F M White wrote:
 TripleText is just an object for storing 4 strings, 3 for the text, 1
 for the image URL. Rest of the code follows, sorry it's quite long...
 
 TripleTextView:
 
 public class TripleTextView extends LinearLayout {
 
 private TextView mText1;
 private TextView mText2;
 private TextView mText3;
 private String imageURL;
 private ImageView image;
 private Drawable imageDrawable;
 public TripleTextView(Context context, TripleText tt) {
 super(context);
 
 this.setOrientation(HORIZONTAL);
 
 //add image
 imageURL = tt.getImageURL();
 try {
 Log.v(TTV,Loading Drawable from: +imageURL);
 imageDrawable = Drawable.createFromStream(new
 URL(imageURL).openStream(), src);
 
 Log.v(TTV,Image created ok);
 } catch (MalformedURLException e) {
 Log.v(TTV,Malformed URL);
 } catch (IOException e) {
 Log.v(TTV,IO Exception);
 }
 image = new ImageView(context);
 image.setImageDrawable(imageDrawable);
 
 addView(image,  new LinearLayout.LayoutParams(
 LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
 LinearLayout subLayout = new LinearLayout(context);
 subLayout.setOrientation(VERTICAL);
 
 mText1 = new TextView(context);
 mText1.setText(tt.getText1());
 
 subLayout.addView(mText1,  new LinearLayout.LayoutParams(
 LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
 
 mText2 = new TextView(context);
 mText2.setText(tt.getText2());
 
 subLayout.addView(mText2, new LinearLayout.LayoutParams(
 LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
 mText3 = new TextView(context);
 mText3.setText(tt.getText3());
 
 subLayout.addView(mText3, new LinearLayout.LayoutParams(
 LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
 addView(subLayout, new LinearLayout.LayoutParams(
 LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
 
 }
 
 public void setText1(String words) {
 mText1.setText(words);
 }
 
 public void setText2(String words) {
 mText2.setText(words);
 }
 public void setText3(String words) {
 mText3.setText(words);
 }
 
 public void setImageURL(String imageURL) {
 this.imageURL = imageURL;
 }
 }
 
 TripleListAdapter:
 
 public class TripleListAdapter extends BaseAdapter {
 
  private Context mContext;
 
  private ListTripleText mItems = new ArrayListTripleText();
 
  public TripleListAdapter(Context context) {
   mContext = context;
  }
 
  public void addItem(TripleText it) { mItems.add(it); }
 
  public void setListItems(ListTripleText lit) { mItems = lit; }
 
  public int getCount() { return mItems.size(); }
 
  public Object getItem(int position) { return mItems.get(position); }
 
  public boolean areAllItemsSelectable() { return false; }
 
  public boolean isSelectable(int position) {
   try{
return mItems.get(position).isSelectable();
   }catch (IndexOutOfBoundsException aioobe){
return false;
   }
  }
 
  public long getItemId(int position) {
   return position;
  }
  public View getView(int position, View convertView, ViewGroup
 parent) {
  TripleTextView ttv;
   if (convertView == null) {
ttv = new TripleTextView(mContext, mItems.get(position));
   } else {
   ttv = (TripleTextView) convertView;
   ttv.setText1(mItems.get(position).getText1());
   ttv.setText2(mItems.get(position).getText2());
   ttv.setText3(mItems.get(position).getText3());
   ttv.setImageURL(mItems.get(position).getImageURL());
   }
   return ttv;
  }
 }

In getView(), in the case where convertView is not null, you are calling
setImageURL(), then doing nothing with that value to actually load in
the replacement image.

Also, you are downloading the images on the main application thread.
That's going to be a problem -- your UI will freeze, and eventually
Android may kill it off with an application not responding error.
Please download your images off the main application thread, such as via
an AsyncTask.

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

_Android Programming Tutorials_ Version 2.0 Available!

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

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


Re: [android-beginners] Images Reused in a ListView

2010-04-20 Thread Tom F M White

Thanks for your help.

On 20/04/2010 15:37, Mark Murphy wrote:

Tom F M White wrote:
   

TripleText is just an object for storing 4 strings, 3 for the text, 1
for the image URL. Rest of the code follows, sorry it's quite long...

TripleTextView:

public class TripleTextView extends LinearLayout {

 private TextView mText1;
 private TextView mText2;
 private TextView mText3;
 private String imageURL;
 private ImageView image;
 private Drawable imageDrawable;
 public TripleTextView(Context context, TripleText tt) {
 super(context);

 this.setOrientation(HORIZONTAL);

 //add image
 imageURL = tt.getImageURL();
 try {
 Log.v(TTV,Loading Drawable from: +imageURL);
 imageDrawable = Drawable.createFromStream(new
URL(imageURL).openStream(), src);

 Log.v(TTV,Image created ok);
 } catch (MalformedURLException e) {
 Log.v(TTV,Malformed URL);
 } catch (IOException e) {
 Log.v(TTV,IO Exception);
 }
 image = new ImageView(context);
 image.setImageDrawable(imageDrawable);

 addView(image,  new LinearLayout.LayoutParams(
 LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
 LinearLayout subLayout = new LinearLayout(context);
 subLayout.setOrientation(VERTICAL);

 mText1 = new TextView(context);
 mText1.setText(tt.getText1());

 subLayout.addView(mText1,  new LinearLayout.LayoutParams(
 LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));

 mText2 = new TextView(context);
 mText2.setText(tt.getText2());

 subLayout.addView(mText2, new LinearLayout.LayoutParams(
 LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
 mText3 = new TextView(context);
 mText3.setText(tt.getText3());

 subLayout.addView(mText3, new LinearLayout.LayoutParams(
 LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
 addView(subLayout, new LinearLayout.LayoutParams(
 LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));

 }

 public void setText1(String words) {
 mText1.setText(words);
 }

 public void setText2(String words) {
 mText2.setText(words);
 }
 public void setText3(String words) {
 mText3.setText(words);
 }

 public void setImageURL(String imageURL) {
 this.imageURL = imageURL;
 }
}

TripleListAdapter:

public class TripleListAdapter extends BaseAdapter {

  private Context mContext;

  private ListTripleText  mItems = new ArrayListTripleText();

  public TripleListAdapter(Context context) {
   mContext = context;
  }

  public void addItem(TripleText it) { mItems.add(it); }

  public void setListItems(ListTripleText  lit) { mItems = lit; }

  public int getCount() { return mItems.size(); }

  public Object getItem(int position) { return mItems.get(position); }

  public boolean areAllItemsSelectable() { return false; }

  public boolean isSelectable(int position) {
   try{
return mItems.get(position).isSelectable();
   }catch (IndexOutOfBoundsException aioobe){
return false;
   }
  }

  public long getItemId(int position) {
   return position;
  }
  public View getView(int position, View convertView, ViewGroup
parent) {
  TripleTextView ttv;
   if (convertView == null) {
ttv = new TripleTextView(mContext, mItems.get(position));
   } else {
   ttv = (TripleTextView) convertView;
   ttv.setText1(mItems.get(position).getText1());
   ttv.setText2(mItems.get(position).getText2());
   ttv.setText3(mItems.get(position).getText3());
   ttv.setImageURL(mItems.get(position).getImageURL());
   }
   return ttv;
  }
}
 

In getView(), in the case where convertView is not null, you are calling
setImageURL(), then doing nothing with that value to actually load in
the replacement image.

Also, you are downloading the images on the main application thread.
That's going to be a problem -- your UI will freeze, and eventually
Android may kill it off with an application not responding error.
Please download your images off the main application thread, such as via
an AsyncTask.

   


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

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Content provider example besides Contacts.

2010-04-20 Thread Gabriel A. Zorrilla
Hi there. I'm trying to develop a simple APN changer. I checked the
tutorials and the CP are basicaly some sql databases accesed with a
pointer. The thing is, for example, that the APN value seems to be in
the settings DB? I dont find a clear reference to that in the API nor
i can access it using the technique shown in the Contacts tutorial.

Some lines of code to illustrate how to access the APN info me would
be really apreciated! Sorry if this is terrible newbish, but cant find
a simple non contact based tutorial regarding CPs.

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

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Re: Screen height?

2010-04-20 Thread BobG
On Apr 20, 2:16 am, Justin Anderson janderson@gmail.com wrote:
 May I ask why you need something like that?
===
Dev phone 2, supposed to be 320x480, so I go to draw a graph from 0 to
319 and it looks like its too big by the size of the title bar and
status bar. How am I supposed to get the size of the screen?

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

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


Re: [android-beginners] Re: Screen height?

2010-04-20 Thread Justin Anderson
After I asked my question, murali answered yours... I wasn't sure, but was
curious why you needed it.  The Display class is what you want.

--
There are only 10 types of people in the world...
Those who know binary and those who don't.
--


On Tue, Apr 20, 2010 at 10:54 AM, BobG bobgard...@aol.com wrote:

 On Apr 20, 2:16 am, Justin Anderson janderson@gmail.com wrote:
  May I ask why you need something like that?
 ===
 Dev phone 2, supposed to be 320x480, so I go to draw a graph from 0 to
 319 and it looks like its too big by the size of the title bar and
 status bar. How am I supposed to get the size of the screen?

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

 NEW! Try asking and tagging your question on Stack Overflow at
 http://stackoverflow.com/questions/tagged/android

 To unsubscribe from this group, send email to
 android-beginners+unsubscr...@googlegroups.comandroid-beginners%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-beginners?hl=en


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

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] play an audio file on a voice call

2010-04-20 Thread george
Hi all

i want to play an audio file on a voice call

as following

the application initiates a call from device X to device Y

when Y replies

application on device X should inject an audio file in the stream of
the call

so device Y hears this audio file

if any help i'm waiting

Thanks much
George

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

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Re: How often does an activity run?

2010-04-20 Thread Indicator Veritatis
It is most definitely not a zombie process. A zombie process, by
definition, is one not even the shell command 'kill' can kill. The
process you just described is still able to receive events -- and will
the next time the OS decides to call onDraw.

It is Android that decides when to call onDraw(). However, you can
tell it to do so by calling postInvalidate() or invalidate() as
described in http://developer.android.com/guide/topics/graphics/index.html

On Apr 18, 11:37 pm, BobG bobgard...@aol.com wrote:
 If we run a simple little hello world program that just puts some text
 in a textview, I see the the onCreate runs, and I guess it calls
 ondraw once, then it sort of returns to the os, and if we have
 registered a sensor changed or an onclick listener, we can read the
 sensor and call invalidate and the os will call ondraw again, and it
 all is usually 'fast enough'. But my question is: Does ondraw ever get
 called again? Or is this now a 'zombie process' that will just sit
 there taking up memory until we kill it?

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

 NEW! Try asking and tagging your question on Stack Overflow 
 athttp://stackoverflow.com/questions/tagged/android

 To unsubscribe from this group, send email to
 android-beginners+unsubscr...@googlegroups.com
 For more options, visit this group 
 athttp://groups.google.com/group/android-beginners?hl=en

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

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Re: Android Emulator don't show up (Linux Fedora 12 x86_64)

2010-04-20 Thread Indicator Veritatis
I didn't have to follow that many steps to get it up and running. Yet
I am running under Fedora, too.

For example, 'yum' will allow wild-cards, so that where he ran many
yum commandlines, I needed only one. Nor do I remember having to
twiddle with permissions.

Then again, I am still running SDK v. 1.6. I never felt a compelling
need to jump to 2.1 when most phones are still running 1.5 or 1.6
binaries anyway. Until recently, it has been easier to find books and
websites documenting how to use SDK 1.6 anyway.

On Apr 17, 9:12 am, Miguel Guirao mgui...@gmail.com wrote:
 wow!! all this have to be done in order to get Android up and running??
 I have been following the instrucctions on the Android web site and it is
 far more simple than all these!!

 how come??

 On Sat, Apr 17, 2010 at 2:03 AM, Michael Cheselka chese...@gmail.comwrote:

  Hello,

  I just installed android 2.1 on Fedora 12 x86_64 and it's working for me.

  1st step, I followed other peoples advice and installed the following rpms:

     yum install glibc.i686 glibc-devel.i686 libstdc++.i686
  zlib-devel.i686 ncurses-devel.i686 libX11-devel.i686 libXrandr.i686

  2nd step, I installed the latest Sun Microsystems JDK and JRE for
  x86_64 RPM based Linuxes:

     yum install jdk-6u20-linux-amd64.rpm jre-6u20-linux-amd64.rpm
  sun-javadb-common-10.5.3-0.2.i386.rpm
  sun-javadb-core-10.5.3-0.2.i386.rpm
  sun-javadb-client-10.5.3-0.2.i386.rpm
  sun-javadb-demo-10.5.3-0.2.i386.rpm
  sun-javadb-docs-10.5.3-0.2.i386.rpm
  sun-javadb-javadoc-10.5.3-0.2.i386.rpm --nogpgcheck

  3rd step, I twiddled the permissions on my Android dir:

     [ ! -d /opt ]  sudo mkdir -m 0755 /opt
     sudo tar zxvf
  /home/${USER}/Downloads/android-sdk_r05-linux_86.tgz -C /opt/.

     sudo chown -Rf ${USER}:${USER} /opt/android-sdk-linux_86/.
     chcon -R -u system_u /opt/android-sdk-linux_86/.
     chmod -Rf o-wx /opt/android-sdk-linux_86/.
     chmod -Rf a+r /opt/android-sdk-linux_86/.
     find /opt/android-sdk-linux_86 -type d -exec chmod a+x '{}' \;

     cd /opt/android-sdk-linux_86/tools
     chmod a+x adb android apkbuilder ddms dmtracedump draw9patch
  emulator etc1tool hierarchyviewer hprof-conv layoutopt mksdcard
  sqlite3 traceview zipalign
     chcon -t bin_t adb android apkbuilder ddms dmtracedump draw9patch
  emulator etc1tool hierarchyviewer hprof-conv layoutopt mksdcard
  sqlite3 traceview zipalign

  Details:
  * Name: droid
  * Target: Android 2.1 - API Level 7
  * Size: 512MiB
  * Skin: HVGA

  Result: works fine.

  Finally:
  # rpm -qa --qf '%{name}-%{version}-%{release}.%{arch}\n' | egrep
  '\.i686$' | egrep 'audio|arts|alsa|sound|glibc|gcc|\+\+' | sort
  alsa-lib-1.0.22-2.fc12.i686
  alsa-lib-devel-1.0.22-2.fc12.i686
  alsa-plugins-pulseaudio-1.0.22-1.fc12.i686
  arts-1.5.10-12.fc12.i686
  audiofile-0.2.6-11.fc12.i686
  audiofile-devel-0.2.6-11.fc12.i686
  compat-libstdc++-296-2.96-143.i686
  compat-libstdc++-33-3.2.3-68.i686
  esound-devel-0.2.41-3.fc12.i686
  esound-libs-0.2.41-3.fc12.i686
  glibc-2.11.1-4.i686
  glibc-devel-2.11.1-4.i686
  jack-audio-connection-kit-0.118.0-1.fc12.i686
  libgcc-4.4.3-4.fc12.i686
  libstdc++-4.4.3-4.fc12.i686
  libstdc++-devel-4.4.3-4.fc12.i686
  pulseaudio-libs-0.9.21-5.fc12.i686
  pulseaudio-libs-devel-0.9.21-5.fc12.i686
  pulseaudio-libs-glib2-0.9.21-5.fc12.i686
  pulseaudio-libs-zeroconf-0.9.21-5.fc12.i686
  wine-pulseaudio-1.1.38-1.fc12.i686

  Regards,
  Michael Cheselka
  650-488-4820

  On Fri, Apr 16, 2010 at 19:28, Michael Cheselka chese...@gmail.com
  wrote:
   Hello,

   This is wrong!  Pulse Audio is new, not old.  People are using it more
   and more not less and less.

   It is working better all the time on Fedora 12.  Originally I had
   problems now and then with Pulse Audio but  not in the last few
   months.  In fact, my bluetooth headphones work best under Fedora 12
   than under Vista 64 Ultimate or XP Pro.

   It is used now with Gnome, MS Windows, and the Palm Pre.

   Try to fix the problem rather than strip down the OS.

   Read about Pulse Audio here:

  http://en.wikipedia.org/wiki/PulseAudio

   Regards,
   Michael Cheselka
   650-488-4820

   On Fri, Apr 16, 2010 at 15:37, Indicator Veritatis mej1...@yahoo.com
  wrote:
   You should not have to disable audio to run the emulator.

   I wish I could be sure my proposal would work for this problem, but I
   don't: since it is a good idea anyway, I will go ahead and say you
   should try removing pulse-audio from your Fedora installation, since
   nobody uses it anymore anyway, yet it causes lots of weird problems.

   I have a lot fewer audio problems ever since removing pulse about a
   month ago. Unfortunately, I can't remember exactly how it is done: try
   yum info pulse-audio as superuser to see if that gives you the exact
   package name to remove. Then remove it with yum remove pacakge-
   name

   On Apr 14, 1:34 pm, yodaa yodaa...@gmail.com wrote:
   I hopefully found a workaround
   see:
 

[android-beginners] ImageView in ListActivity won't scale...

2010-04-20 Thread MagouyaWare
I posted this same question on StackOverflow two days ago and haven't
received a response yet so I figured I would try my luck on here.  For
those interested here is the link to stackoverflow:
http://stackoverflow.com/questions/2661223/imageview-scale-type-not-working-in-list-activity

I have used ImageView's before and understand the different scale
types that can be set... However I am having an incredibly difficult
time trying to get an ImageView to scale properly in the row of a
ListActivity or an ExpandableListActivity.

I have tried setting the android:scaleType property to every single
value but the image never scales down. I have set the min and max
sizes as well and they don't seem to have any effect. I have done both
of these things in both the XMl and in code to no avail...

Does anyone have any ideas or perhaps a workaround?

Here is the XML for my group row for an ExpandableListView:
?xml version=1.0 encoding=utf-8?
RelativeLayout
xmlns:android=http://schemas.android.com/apk/res/android;
android:layout_width=fill_parent
android:layout_height=wrap_content
android:padding=6dip

ImageView
android:id=@+id/item_selection_icon_id
android:layout_width=wrap_content
android:layout_height=wrap_content
android:layout_marginRight=5dp
android:layout_marginLeft=30dp
android:minWidth=10dp
android:minHeight=10dp
android:maxWidth=10dp
android:maxHeight=10dp
android:scaleType=centerInside
/

!--  App Name --
TextView
android:id=@+id/item_app_name_id
android:layout_width=fill_parent
android:layout_height=wrap_content
android:layout_toRightOf=@id/item_selection_icon_id
android:layout_alignBaseline=@id/item_selection_icon_id
android:textStyle=normal|bold
android:textSize=24sp
/

!-- Package Information --
TextView
android:id=@+id/item_app_pkg_name_id
android:layout_width=fill_parent
android:layout_height=wrap_content
android:layout_below=@id/item_app_name_id
android:layout_toRightOf=@id/item_selection_icon_id
android:layout_weight=2
android:textStyle=italic
android:textSize=12sp
/
/RelativeLayout


Thanks in advance for any help!

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

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Re: Is there a concept like DLL in Andoirds?

2010-04-20 Thread Indicator Veritatis
So the short answer to his original question, whether or not there is
a 'DLL concept' in Android, is 'no'.

If he really wants to, he can use the NDK as you suggest, but that
sounds like a lot of custom work for trying to support a C/C++
paradigm in a Java world, an approach that is likely to offer more
pain than profit. Android is based on Java, it is only to be expected
that the Java way will be more natural.

On Apr 16, 10:30 am, Kitzy kitzyk...@gmail.com wrote:
 You can create libraies in C/C++ and share them with your
 applications. Look at the NDK to see if that may help.

 http://developer.android.com/sdk/ndk/index.html

 -Kitzy

 On Apr 16, 12:01 am, Prashant Shelar shelar...@gmail.com wrote:



  Hello,

  I know that we can use a concept Java Package but I just wanted to
  know that whether Android has provided a DLL concept where I can my
  most of the functionality.

  Is there any concept like DLL on Android OS?

  Can we develop a DLL for better modularization and other benefits on
  Android?

  Thanks and Regards,
  Prashant.

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

  NEW! Try asking and tagging your question on Stack Overflow 
  athttp://stackoverflow.com/questions/tagged/android

  To unsubscribe from this group, send email to
  android-beginners+unsubscr...@googlegroups.com
  For more options, visit this group 
  athttp://groups.google.com/group/android-beginners?hl=en

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

 NEW! Try asking and tagging your question on Stack Overflow 
 athttp://stackoverflow.com/questions/tagged/android

 To unsubscribe from this group, send email to
 android-beginners+unsubscr...@googlegroups.com
 For more options, visit this group 
 athttp://groups.google.com/group/android-beginners?hl=en

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

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


[android-beginners] Any idea why the following code crashes the app? It happens in calculateGmt()

2010-04-20 Thread Traveler
package Adkins.GMTpackage;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.EditText;


public class GMTactivity extends Activity implements OnClickListener {
TextView title;
TextView minsattitle;
TextView minustitle;
TextView minsatoutput;
TextView minusoutput;
TextView gmtinput;
Button gmtbutton;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);

title = (TextView)this.findViewById(R.id.title);
minsattitle = (TextView)this.findViewById(R.id.minsattitle);
minustitle = (TextView)this.findViewById(R.id.minustitle);
gmtinput = (TextView)this.findViewById(R.id.gmtinput);
gmtbutton = (Button)this.findViewById(R.id.gmtbutton);
gmtbutton.setOnClickListener(this);
}

public void onClick(View v) {
calculateGmt();
}

@SuppressWarnings(null)
protected void calculateGmt() {

double val = Double.parseDouble(gmtinput.getText().toString());
// in a real app, we'd get this off the 'net
minsatoutput.setText(Double.toString(val * 2));
}
}

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

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


Re: [android-beginners] Re: Android Emulator don't show up (Linux Fedora 12 x86_64)

2010-04-20 Thread Michael Cheselka
Hello Indicator,

Of course this is true.  I did this in anticipation of trouble and
afterwards found none.  I'd still twiddle the permissions just for
safeties sake.

Regards,
Michael Cheselka
650-488-4820




On Tue, Apr 20, 2010 at 15:54, Indicator Veritatis mej1...@yahoo.com wrote:
 I didn't have to follow that many steps to get it up and running. Yet
 I am running under Fedora, too.

 For example, 'yum' will allow wild-cards, so that where he ran many
 yum commandlines, I needed only one. Nor do I remember having to
 twiddle with permissions.

 Then again, I am still running SDK v. 1.6. I never felt a compelling
 need to jump to 2.1 when most phones are still running 1.5 or 1.6
 binaries anyway. Until recently, it has been easier to find books and
 websites documenting how to use SDK 1.6 anyway.

 On Apr 17, 9:12 am, Miguel Guirao mgui...@gmail.com wrote:
 wow!! all this have to be done in order to get Android up and running??
 I have been following the instrucctions on the Android web site and it is
 far more simple than all these!!

 how come??

 On Sat, Apr 17, 2010 at 2:03 AM, Michael Cheselka chese...@gmail.comwrote:

  Hello,

  I just installed android 2.1 on Fedora 12 x86_64 and it's working for me.

  1st step, I followed other peoples advice and installed the following rpms:

     yum install glibc.i686 glibc-devel.i686 libstdc++.i686
  zlib-devel.i686 ncurses-devel.i686 libX11-devel.i686 libXrandr.i686

  2nd step, I installed the latest Sun Microsystems JDK and JRE for
  x86_64 RPM based Linuxes:

     yum install jdk-6u20-linux-amd64.rpm jre-6u20-linux-amd64.rpm
  sun-javadb-common-10.5.3-0.2.i386.rpm
  sun-javadb-core-10.5.3-0.2.i386.rpm
  sun-javadb-client-10.5.3-0.2.i386.rpm
  sun-javadb-demo-10.5.3-0.2.i386.rpm
  sun-javadb-docs-10.5.3-0.2.i386.rpm
  sun-javadb-javadoc-10.5.3-0.2.i386.rpm --nogpgcheck

  3rd step, I twiddled the permissions on my Android dir:

     [ ! -d /opt ]  sudo mkdir -m 0755 /opt
     sudo tar zxvf
  /home/${USER}/Downloads/android-sdk_r05-linux_86.tgz -C /opt/.

     sudo chown -Rf ${USER}:${USER} /opt/android-sdk-linux_86/.
     chcon -R -u system_u /opt/android-sdk-linux_86/.
     chmod -Rf o-wx /opt/android-sdk-linux_86/.
     chmod -Rf a+r /opt/android-sdk-linux_86/.
     find /opt/android-sdk-linux_86 -type d -exec chmod a+x '{}' \;

     cd /opt/android-sdk-linux_86/tools
     chmod a+x adb android apkbuilder ddms dmtracedump draw9patch
  emulator etc1tool hierarchyviewer hprof-conv layoutopt mksdcard
  sqlite3 traceview zipalign
     chcon -t bin_t adb android apkbuilder ddms dmtracedump draw9patch
  emulator etc1tool hierarchyviewer hprof-conv layoutopt mksdcard
  sqlite3 traceview zipalign

  Details:
  * Name: droid
  * Target: Android 2.1 - API Level 7
  * Size: 512MiB
  * Skin: HVGA

  Result: works fine.

  Finally:
  # rpm -qa --qf '%{name}-%{version}-%{release}.%{arch}\n' | egrep
  '\.i686$' | egrep 'audio|arts|alsa|sound|glibc|gcc|\+\+' | sort
  alsa-lib-1.0.22-2.fc12.i686
  alsa-lib-devel-1.0.22-2.fc12.i686
  alsa-plugins-pulseaudio-1.0.22-1.fc12.i686
  arts-1.5.10-12.fc12.i686
  audiofile-0.2.6-11.fc12.i686
  audiofile-devel-0.2.6-11.fc12.i686
  compat-libstdc++-296-2.96-143.i686
  compat-libstdc++-33-3.2.3-68.i686
  esound-devel-0.2.41-3.fc12.i686
  esound-libs-0.2.41-3.fc12.i686
  glibc-2.11.1-4.i686
  glibc-devel-2.11.1-4.i686
  jack-audio-connection-kit-0.118.0-1.fc12.i686
  libgcc-4.4.3-4.fc12.i686
  libstdc++-4.4.3-4.fc12.i686
  libstdc++-devel-4.4.3-4.fc12.i686
  pulseaudio-libs-0.9.21-5.fc12.i686
  pulseaudio-libs-devel-0.9.21-5.fc12.i686
  pulseaudio-libs-glib2-0.9.21-5.fc12.i686
  pulseaudio-libs-zeroconf-0.9.21-5.fc12.i686
  wine-pulseaudio-1.1.38-1.fc12.i686

  Regards,
  Michael Cheselka
  650-488-4820

  On Fri, Apr 16, 2010 at 19:28, Michael Cheselka chese...@gmail.com
  wrote:
   Hello,

   This is wrong!  Pulse Audio is new, not old.  People are using it more
   and more not less and less.

   It is working better all the time on Fedora 12.  Originally I had
   problems now and then with Pulse Audio but  not in the last few
   months.  In fact, my bluetooth headphones work best under Fedora 12
   than under Vista 64 Ultimate or XP Pro.

   It is used now with Gnome, MS Windows, and the Palm Pre.

   Try to fix the problem rather than strip down the OS.

   Read about Pulse Audio here:

  http://en.wikipedia.org/wiki/PulseAudio

   Regards,
   Michael Cheselka
   650-488-4820

   On Fri, Apr 16, 2010 at 15:37, Indicator Veritatis mej1...@yahoo.com
  wrote:
   You should not have to disable audio to run the emulator.

   I wish I could be sure my proposal would work for this problem, but I
   don't: since it is a good idea anyway, I will go ahead and say you
   should try removing pulse-audio from your Fedora installation, since
   nobody uses it anymore anyway, yet it causes lots of weird problems.

   I have a lot fewer audio problems ever since removing pulse about a
   month ago. Unfortunately, I can't remember exactly how