Hi All,
Recently, I started working on android. Earlier I have worked on BREW
and some native platforms for mobile application development. I was
facing a few problems, the solution to which I figured out after
digging in android logs/google/developer docs. I would like to share
it with the newbies so that they dont have to spend much time doing
this :)
Ques --> How to extract a view in code from the xml ?
Ans -->
Infact, I am using "android-sdk-windows-1.0_r2" and I found it quite
strange that when I define a ListView in XML as
<ListView id="@+id/my_list" ...... />, I am unable to retrieve it
using findViewById. I think we need to define it as
<ListView
android:id="@+id/my_list" ..../> because after defining the ID this
way, I was able to retrieve it using findViewById. So if you are
facing the same problem, try this out :)
Ques --> How to start an activity (explicit) ??
Ans -->
There are three things you need to do.
1. Declare the activity in the Android Manifest.
<activity android:name=".browsemode" // name of the class
android:label="@string/browse_app_name"> // string
defined in values/strings.xml
</activity>
2. Define the activity class ( extends Activity)
3. Call It.
eg I have used the explicit intent mechanism here :-
Intent browseIntent = new Intent();
browseIntent.setClassName("com.google.androidtest",
"com.google.androidtest.browsemode");
try {
startActivity(browseIntent);
} catch (ActivityNotFoundException ex) {
System.out.println(ex.getMessage());
}
Hope it helps!!!!
- Robin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---