[android-beginners] Re: XML Layout Language

2009-06-15 Thread Tseng



On Jun 13, 12:01 am, Mitch  wrote:
> Does anyone know a link to the specification for the XML Layout?  I'm
> looking for a description of the tags etc.  Since I'm new and just
> learning, a simplified version would be nice, focusing on the most
> common tags.  Everything I read now is vague.
There are no common tags in XML (unlike in HTML or X-HTML which are
subclasses of XML). In case of android every subclass of View can be
an Element. You can even create your own subclasses of View and use
them in the layout XML files.

You can check for some very basics at
http://tseng-blog.nge-web.net/blog/2009/01/30/android-creating-xml-uis/

> - What does xmlns mean?
> - What does the "http://schemas.android.com/apk/res/android"; do?
xmlns means Extended Markup Language (XML) namespace (NS)

It's a unique identifier/namespace. The http:// part is just the name
of this namespace. Theoretically it could also have been called
"ljkjasd09kalsdj092", as long as it's unique. Most developers who
create some schemas usually chose a URL as name. For example if you
want to use X-HTML transitional (also a subform of XML) the xmlns
would be http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd, so
(in this case) the browser knows that this document is an X-HTML 1.0
transitional file and can parse it correctly. For android keep it at
http://schemas.android.com/apk/res/android and don't change it

> - What is the android: sytnax all about?
Android is the namespace you defined above with
xmlns:android="http://schemas.android.com/apk/res/android";. It tells
the compiler that it's related to android

> - Can you create your own Layouts like the "LinearLayout"?
Yes, but you have to do it in code first. You create your own class
which expands ViewGroup or one of the existing Layout classes, for
example:
class MyLayout expands LinearLayout {... }

Once you did it in code, you can use it in the XML files too, but you
have to use full qualified name of the class, like:
...
instead of
...

> - Is there a list of available components like "Button", "TextView"?
Basically all subclasses of View
http://developer.android.com/reference/android/view/View.html

> - What does the @ symbol do?
http://developer.android.com/guide/topics/resources/available-resources.html

It tells the compiler that you want to access a resource. Here are two
differences:
If you're using android:icon="@android:drawable/someicon" then you can
access android resources (which are part of the android OS/SDK). If
you use android:icon="@drawable/someicon" (notice that the android: is
missing after the @) then you're accessing resources of your
application.

> - Can I edit this directly in Eclipse with a graphical editor rather
> than manipulating text?
Yea, you can. If you have the ADT tools installed (Android Developer
Tools). But the editor mess up with the formating so it's harder to
read it in text after it has been edited by the Editor.

> I'm sure these are probably simple questions answered somewhere, but I
> just can't find the specification and I'm so new I don't seem to be
> able to find the info.

Some Guide:
http://developer.android.com/guide/index.html

Documentation/References:
http://developer.android.com/reference/packages.html

P.S.
One thing you haven't asked, which may be important: Every Element has
different attributes (that android:text etc. inside the elements). You
can find them in the documentation of that class you're using. For
example for a  you have to look at the TextView class
at
http://developer.android.com/reference/android/widget/TextView.html

It will have a section called "XML Attributes" and "Inherited XML
Attributes" where you can find all valid attributes for that element.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
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: EditText

2009-06-15 Thread Tseng

http://developer.android.com/reference/android/view/View.OnLongClickListener.html

Implement an View.OnLongClickListener and set it to your EditText
via
EditText txt = (EditText)findViewById(R.id.your_edittext_id);
...
txt.setOnLongClickListener(...)

Check out
http://tseng-blog.nge-web.net/blog/2009/02/14/implementing-listeners-in-your-android-java-application/
and
http://tseng-blog.nge-web.net/blog/2009/02/17/how-implement-your-own-listener-android-java/

If you want to know more about listeners and how to implement them.


On Jun 14, 6:36 pm, Synapse  wrote:
> How can I change choise from contextual menu of EditText ( Menu that
> includes copy/paste funcionality ) ?
> Anyone has some piece of code?
>
> Synapse
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
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: Guide for Dummies? Absolutely new ne to programming.

2009-04-05 Thread Tseng

Yep, Java should be the first step you should do before starting
Android development.

Technically it's not java which is used on android, because Android
use it's own Virtual Machine called Dalvik virtual machine (DalvikVM)
to execute the compiled bytecode on the phone, while Java uses the
Java virtual machine (JVM). But the syntax is basically identical with
that one of java. So java knowledge is important. Dunno about Java
tutorials.
I came from C# corner (which is very similar to Java syntaxwise) and
we used java as OOP language too in our school, so i didn't need any
beginners tutorials.

Once you've done with the basics (syntax, classes, extending classes,
etc.) you could basically start with some easy Android examples. Dunno
about free tutorials too, as most you may find are totally outdated
ones for the SDKs older than 1.0 and most of them don't work anymore
(because most of the API changed since then), so they are quite bad as
tutorials.

However, i can suggest you a few books i've found very usefull when I
started with android.

[McGraw Hill - Android A Programmers Guide]
I've found this very useful, especially the part on creating
ContentProviders to store and read data fro SQLlite database

[Professional Android App]
For general stuff, like Broadcast receivers, Background threads or
accessing the hardware (acceleramators, compass etc)


On Apr 3, 5:40 pm, KonstantinDK  wrote:
> Well, kinda. I'm not a programmer, I'm finance major, but computers
> were always my hobby. A had few programming classes and were always
> good in them. I have the understanding of how it works and know the
> logic.
>
> The only thing I don't know is language. ( long time ago did some
> Pascal and visual basic, but that crapp doesn't count). So, what I am
> asking is: if i want to learn how to create apps for android, what is
> the best way to learn? As I understand the Java is, maybe not only,
> but the main language for this?
>
> So, if I want to learn, will regular Java courses work? Is it the only
> thing I need to learn? Any more advice? Websites where you can learn
> it (I'll surely google it, but maybe you know particular good source).
> Also, how long, you think, it's gonna take. Assuming I'm very fast
> learner and have a mind of programmer.
>
> P.S.They should really add smiles to the forums.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
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: Why Prefer Virtual Over Interface?

2009-04-05 Thread Tseng

P.S. Forgot to mention: it's not as simple as casting it to the right
type ((HashMap).myMap1).someMethod(...), but it's the need of
refactoring to determinate the correct type of the underlying
impelementation which is quite costly operation in terms of CPU cycles

On Apr 3, 10:04 am, OT  wrote:
> Hi all,
>
>            I don't known why "Calling through an interface reference
> can take 2x longer than a virtual method call through a concrete
> reference"? Could someone help to explain it, thank you very much.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
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: Why Prefer Virtual Over Interface?

2009-04-05 Thread Tseng

For performance reasons. If you're using the interface reference, the
interface needs to be converted to the right underlying type (in the
developer guide on android.com from a general Map to HashMap, so
basically it's a similar to doing ((HashMap)myMap1).anyMethod(...)).

It may be ok, if you use this once in your code, but it can get really
bad if you do it in a do/for/foreach-loop, as evertime you'd call the
method, it would to do the work above.

However, sometimes you have to use the interface, if it's part of an
API and you don't know in advance what kind of implementation the user
would use, so you're forced to stick with the generic version.

What it says (and that's what you can read in the guide which you
obviously did ^^) is: If you know, that you will only be using HashMap
in your function/application/activity/whatever, then there is no need
to use generic Map interface, as it needs less CPU cylces = less CPU
performance = faster code = longer battery life. This is important in
embedded devices development, but not so important if you're
developing for a Desktop PC with fast CPUs and no batteries at all.

On Apr 3, 10:04 am, OT  wrote:
> Hi all,
>
>            I don't known why "Calling through an interface reference
> can take 2x longer than a virtual method call through a concrete
> reference"? Could someone help to explain it, thank you very much.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
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 do I set the value of an EditText

2009-03-28 Thread Tseng

Hehe,
yep, that's the most common error beginers make when start with
android and i already mentioned it in my post above ^^

On Mar 26, 2:41 pm, Lovedumplingx  wrote:
> Holy Mother Dogfood!!!
>
> I am quite possibly an idiot (that's the second time I'm saying this
> today)!  Wow.  So simple and yet I was looking at it all backward.
>
> Thanks so much.  It makes sense now.
>
> On Mar 25, 4:34 pm, Mark Murphy  wrote:
>
>
>
> > Lovedumplingx wrote:
> > > So I see the NullPointer Exception as a good starting point but I'm
> > > still perplexed.
>
> > > I created a new project just for testing. And I can't get this to
> > > work:
>
> > > package com.test;
>
> > > import android.app.Activity;
> > > import android.os.Bundle;
> > > import android.widget.EditText;
>
> > > public class main extends Activity {
> > >     /** Called when the activity is first created. */
> > >     EditText justFillIn;
>
> > >   �...@override
> > >     public void onCreate(Bundle savedInstanceState) {
> > >         super.onCreate(savedInstanceState);
>
> > >         justFillIn = (EditText) findViewById(R.id.ipText);
> > >         justFillIn.setText("charSequence is a string");
>
> > >         setContentView(R.layout.main);
> > >     }
> > > }
>
> > > All I want to do is set the value for that EditText and it's just not
> > > working.
>
> > You must call setContentView() first.
>
> > You aren't telling Android what layout to display until you call
> > setContentView(). Hence, until that time, findViewById() is guaranteed
> > not to work, because there are no views to find.
>
> > --
> > Mark Murphy (a Commons Guy)http://commonsware.com
> > Android App Developer Books:http://commonsware.com/books.html- Hide quoted 
> > text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
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 do I set the value of an EditText

2009-03-21 Thread Tseng

An error message would be helpful Otherwise it's hard to help you,
other than "guessing" what could be the reasons for it.

Maybe you haven't set the ID correctly, using a wrong ID (which
doesn't even exist in the XML Layout file) or you're using
setContentView/setView after you have using "findViewById". This could
throw up a NullPointer Exception when you try to access (because
findViewById returns 0 if no layout has been set or the View with this
ID was not found).


On Mar 20, 9:00 pm, Lovedumplingx  wrote:
> That's what I thought too but I crash the task every time the activity
> that contains this code is started:
>
> EditText userText = (EditText) findViewById(R.id.userText);
> userText.setText(userParam);
>
> This is the basic way I thought to have the value set but it crashes
> every time.
>
> On Mar 19, 10:53 pm, Isaac Waller  wrote:
>
>
>
> > A String _is_ a CharSequence. There is no need for a cast.
>
> > On Mar 19, 3:35 pm, Will  wrote:
>
> > > Cast the String to a CharSequence.
>
> > > String x = "foo";
> > >EditTextET;
> > > ET.setText((CharSequence) x);
>
> > > On Mar 19, 10:43 am, Lovedumplingx  wrote:
>
> > > > Ok...so I've scoured and scoured and played and fiddled but I can't
> > > > figure it out.
>
> > > > I want to allow the user to set preferences for an application and I
> > > > want the preferences to be displayed in theEditTextarea if/when they
> > > > come back to change them again.
>
> > > > In my head I'm thinking I would be able to use setText() but no...that
> > > > takes a CharSequence and I have a string and don't know how to make a
> > > > CharSequence (which according to what I've read is supposed to be a
> > > > read-only thing anyway).
>
> > > > So...does anyone know how to put text into anEditTextfield without
> > > > relying on the XML?  I really want to do this via application
> > > > preferences.
>
> > > > Thanks.- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
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: Intents and Activities

2009-03-11 Thread Tseng

Yea, Intents are kind of events. You can use them to call or
communicate with other Activities or Applications.

And you can add extra data (Intent.putExtra(...)) to send data to
other activities

On Mar 10, 9:06 pm, Lovedumplingx  wrote:
> Don't know if this went through last time so I'll post again
>
> So I'm still working to get the paradigm down.
>
> Activities are related to screens and everything you want a user to
> see needs to be part of an activity.  But what's with the Intent?  Are
> all intents tied to an activity?
>
> I thought I had read that Intents were more like events.  If that's
> the case cool...but I'm really struggling on where Intents fit into
> the whole concept.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
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: EditText appearance

2009-03-11 Thread Tseng

You could create a colorstate list (xml file in res/drawable), for
example
http://developer.android.com/reference/android/content/res/ColorStateList.html

Here is an example i used for textcolors. Should work for HintColors
too!

res/drawabale/myedittextcolors.xml:


http://schemas.android.com/apk/res/android";>






Now you only have to assign it to your EditText widget.

Edit the XML and change

android:textColorHint="#FF"

to

android:textColorHint="@drawable/myedittextcolors"

and it should work. This is usefull if you want to have different
colors depending on the state of the edittext (i.e. if its focused,
clicked, etc).

For one color,
use android:textColorHint="#FF" or android:textColorHint="@color/
mycustomcolor" if you have defined your color in /res/values/
colors.xml







On Mar 10, 11:30 am, "Mr.No"  wrote:
> Hello,
> how do i change the size, style, typeface of a hint?
> If the EditText gains the focus the border-color changes to orange,
> how do i set a other color?
>
> rgds
>        Mr.No
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
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 to format time in millis to human readable?

2009-03-06 Thread Tseng

I wouldn't really use this method to be honest. Even the Android
Documentation sugest to use native methods, instead of writing your
own stuff for methods which are already available (i.e. simple date
formating).

[Use Native Methods]
http://developer.android.com/guide/practices/design/performance.html#native_methods

On Mar 6, 1:20 pm, droozen  wrote:
> Sometimes I construct my human readable strings in a separate function
> by myself, mostly because I imagine it's faster. Something like.
>
> int iMonth = cal.get(Calendar.MONTH) + 1; // Months from the calendar
> are offset by one. Add one if you want human readable.
> int iDay = cal.get(Calendar.DAY_OF_MONTH);
>
> String month = Integer.toString(iMonth);
> if(iMonth < 10){
>     month = "0" + month; // Otherwise, you might get something like
> 1/1/1900, instead of 01/01/1900
>
> }
>
> String day = Integer.toString(iDay);
> if(iDay < 10){
>     day = "0" + day;
>
> }
>
> String humanReadable = month + "/" + day + "/" cal.get(Calendar.YEAR);
>
> But really, you should be using SimpleDateFormat, I suppose...
>
> On Mar 6, 5:55 am, Łukasz Warchoł  wrote:
>
>
>
> - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
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: Problem with AutoCompleteTextView and SimpleCursorAdapter

2009-03-03 Thread Tseng

You don't have to create your own XML file if you're just want to
display a one-liner dropdown menu. Instead better to use the already
defined one in the android resources. Basically you can leave the
auto_complete.xml, as it's not used anyways in your code (unless you
want to design your own dropdown list views).

Basically there are two reasons:
1. You haven't set the color states correctly so the text color =
background color
or
2. You have selected a wrong id in the "to" parameters

In your example, the latter seems to be the case.

> int[] to = new int[]{android.R.layout.select_dialog_item};
> SimpleCursorAdapter cursAdapt = new SimpleCursorAdapter
> (this,android.R.layout.simple_dropdown_item_1line,cursor,new String[]
> {DbHelper.FOOD_NAME},to);

you're using an layout id as "to". This is wrong. You have to use the
ID of the textfield in which your data belongs.

For example you have to data fields in your cursor, lets say

new String[] { DbHelper.FOOD_NAME, DbHelper.FOOD_PRICE }

Now if you have an layout file, with 2 TextView elements called
foodname and foodprice, you'd have to make the "to" part as follows
new int[] {R.id.foodname, R.id.foodid} in exactly this order. First
element of from (DbHelper.FOOD_NAME) will be placed in the view with
the first ID from "to" (in this case: R.id.foodname).

Since you're using the predefined android layout for the dropdown list
(android.R.layout.simple_dropdown_item_1line), the (only) textview
item is called android.R.id.text1.

So changing
 int[] to = new int[]{android.R.layout.select_dialog_item};
 SimpleCursorAdapter cursAdapt = new SimpleCursorAdapter
 (this,android.R.layout.simple_dropdown_item_1line,cursor,new String[]
 {DbHelper.FOOD_NAME},to);

to

 int[] to = new int[]{android.R.id.text1};
 SimpleCursorAdapter cursAdapt = new SimpleCursorAdapter
 (this,android.R.layout.simple_dropdown_item_1line,cursor,new String[]
 {DbHelper.FOOD_NAME},to);

should do the trick. You HAVE to use android.R.id.text1, because this
is the id which was set in android sdks \res\layout
\simple_dropdown_item_1line.xml file.

This is btw the case for all default android layout files. They have
no fixed names, instead it's always android.R.id.text1 to
android.R.id.text3 or android.R.id.button1 to android.R.id.button3 in
case of buttons (i.e. in default Dialog layouts)


On Mar 2, 10:49 pm, class_java  wrote:
> Hi All,
>
> I have a AutoCompleteTextView and I wont in the drop down list that
> appears while typing to contain data from a database through
> SimpleCursorAdapter. The drop down list appears, but there is not text
> in it. When I click in the drop down item seems to work fine, the Text
> is correctly shown in the AutoCompleteTextView. Please help...
>
> Code samples:
> ***­
> Activity:
>  final AutoCompleteTextView editTxt = (AutoCompleteTextView)
> findViewById(R.id.foodedittext);
>
>         mDbHelper = new DbHelper(this);
>
>         Cursor cursor = mDbHelper.fetchAll();
>         startManagingCursor(cursor);
>         int[] to = new int[]{android.R.layout.select_dialog_item};
>         SimpleCursorAdapter cursAdapt = new SimpleCursorAdapter
> (this,android.R.layout.simple_dropdown_item_1line,cursor,new String[]
> {DbHelper.FOOD_NAME},to);
>         cursAdapt.setCursorToStringConverter(new CursorConverter());
>         editTxt.setAdapter(cursAdapt);
> **
> auto_complete.xml:
>
> 
>
> http://schemas.android.com/apk/res/android";
>         android:id="@+id/auto_complete"
>     android:layout_height="wrap_content"
>     android:layout_width="wrap_content"
>  />
>
> *
> public class CursorConverter implements CursorToStringConverter{
>
>         @Override
>         public CharSequence convertToString(Cursor cursor) {
>          String a = cursor.getString(1);
>          return a;
>         }
>
> }
>
> ***­*
>
> Thanks in advance...
>           Evelina
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
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: Building apps for Java supported mobiles

2009-02-27 Thread Tseng

Well, depends on your application. Basically you can have general
classes which don't use specific API calls. For example XMLparsers or
some calculation/algoryth functions.

The UI elements need completely be rewritten if you're porting it to
android. Maybe even some underlying things too (like exchanging of
data between activities). The security model will also need to be
rewritten. Well its quite a lot.

You should try to make the core functions of your application
independed from J2ME/Android API calls

On Feb 26, 1:56 pm, ThemePark  wrote:
> Say I want to build an application that will run on as many Java
> supported mobile phones as possible, and I would for example use Java
> ME to program this. If I then want to port my code to Android, or
> JavaFX ME, or other Java languages, would I then have to completely
> rewrite my code for all of those languages, or would it be possible to
> make some generic Java code, and make wrappers for each language, so I
> can run it on those mobile phones?
>
> I am not sure of just how much different those languages are from each
> other, hence my question. The application I have in mind, is not
> really complex, and it doesn't really require any GUI, it does require
> access to the internet, specifically a server I plan on setting up,
> for the application to communicate with.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
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: Download of Android Eclipse plugin: 404 Not Found

2009-02-27 Thread Tseng

If you're having problem, simply try using normal http instead of
https like
https://dl-ssl.google.com/android/eclipse/

On Feb 26, 9:26 am, "Klaus, GPSies.com"
 wrote:
> Hi,
>
> I'm trying to download the Eclipse plugin 
> from:https://dl-ssl.google.com/android/eclipse/
> and I'm getting a 404.
>
> Did they change the URL? Where can I get the Android Eclipse plugin?
>
> Thanks and best regards from Berlin, Germany.
>
> Klaus Bechtoldhttp://www.gpsies.com/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
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 to pass data between forms?

2009-02-26 Thread Tseng

Depends.

SessionState sounds like it's a class which extends BaseSavedState
(which is used to preserve states of an widget). For example

private static class SavedState extends BaseSavedState {
long contactId;

public SavedState(Parcel source) {
super(source);
contactId = source.readLong();
}

public SavedState(Parcelable superState) {
super(superState);
}
public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(contactId);
}

public static final Parcelable.Creator CREATOR =
new Parcelable.Creator() {
public SavedState createFromParcel(Parcel in) {
return new SavedState(in);
}

public SavedState[] newArray(int size) {
return new SavedState[size];
}
};
}

If your SessionState indeed extends BaseSavedState, then you can pass
the whole class too. The reason why it would work is, that
View.BaseSavedState is extends AbsSavedState which is an
implementation of the android.os.Parcelable interface

[BasedSavedState]
http://developer.android.com/reference/android/view/View.BaseSavedState.html
[AbsSavedState]
http://developer.android.com/reference/android/view/AbsSavedState.html
[android.os.Parcelable interface]
http://developer.android.com/reference/android/os/Parcelable.html

If you class isn't based on View.BaseSavedState, then you either need
to implement the Parcelable Interface to your class or implement
Serializable interface in order to pass it as to another activites via
Intent/Extras.

>From Intent Documentation on putExtra(...)
putExtra(String name, Parcelable value)
Add extended data to the intent.

putExtra(String name, Serializable value)
Add extended data to the intent.

How ever, depending on the size of your SessionState class, it may be
better idea only to pass the necessary data (sounds like sessions used
in websites), like cookie data, sessionid and parameters only to
recreate the class using this passed data instead of the whole class
(for example if there are objects in like Http Classes, sockets and
similar).

On Feb 24, 7:07 pm, Joseph Arceneaux  wrote:
> What if I have my own custom class, e.g., "SessionState" that I want to pass
> back and forth?
> Thanks,
> Joe
>
> On Mon, Feb 23, 2009 at 6:35 AM, Odessa Silverberg <

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
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 to access LInux shell command from GUI interface with root permission

2009-02-26 Thread Tseng

Don't start deveral new posts, one is enough.

Basically you can't do it. However in R29 Firmware there was an bug,
which allowed commands to be executed. But this was an bug/exploit and
should not be used as basic for a programm to work as it was already
fxied in R30 or R31. So only phones with that old Firmware would work
and 95% of all people already have newer one and the new devices
already get shipped with the fixed version. And the UK/European
Versions of the devices don't even support the older R29 firmwares and
can't even be jailbreaked.

If you want to write an application, you need to do it without "hacks"
and exploits, otherwise your application won't work on 98% of all
devices which effectively renders your application useless

On Feb 24, 5:30 am, steve  wrote:
> Is it a way to access Linux shell command from with the Android SDK? I
> would like to do it as a root user
>
> Thanks,

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
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 to access Linux using Android SDK?

2009-02-26 Thread Tseng

Well, first off:

>From the SDK/Framework (read: from within your Android Application)
itself there is no way to access the underlaying Linux commands
directly if i understand it correctly. If you want to access the shell
of your Emulator or DevG1 Phone, you could do it with the "adb shell"
command, as David already said it.

If you have a T-Mobile G1 or some other "locked" device from other
mobile phone companies, then there is no easy way to access it. You
could hack/jailbreak the Phone with an old Firmware (R29) and then
manually flashing it up to the newest. However, this is not
recommended especially if you want do develop an application which
will make use of it.

On Feb 24, 5:40 am, steve68  wrote:
> Is it a way to access Linux shell command from with the Android SDK? I
> would like to do it as a root user
>
> Thanks,

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
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: App Idea for your consideration

2009-02-26 Thread Tseng

I doubt there will be enough Halo Gamers which are Halo 3 players AND
owners of Android enabled Phone in order to make this application
worthwhile.

On Feb 24, 5:25 pm, Myr Herder  wrote:
> If anyone needs an idea for an app to write, might I suggest one that
> gathers information from Bungie.net's Halo 3 career stats website and
> displays them in a more Android-friendly format?  The website isn't
> exactly designed for mobile devices, as it is graphics-intensive and
> spread across several pages.  I have included some sample screenshots
> constructed from the existing website as a 
> start:http://www.geocities.com/aldenbri/files/halo3app.pdf.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
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
-~--~~~~--~~--~--~---