Problems with new SDK m5

Put your problem here if it does not fit any of the other categories.

Problems with new SDK m5

Postby gvkreddyvamsi » Thu Feb 14, 2008 10:43 am

hi,


I have faced lot problem with new SDK.

The samples which are developed on old SDK m3 are not working on new one.

Here major change comes under AndroidManifest.xml

Need to create application again as fresh and to add src, res folders from old application.

In file browser application android.net.ContentURI; package not found after updating SDK. Is it omitted or rebuilt with other name?

by
vamsi
gvkreddyvamsi
Developer
Developer
 
Posts: 43
Joined: Mon Jan 21, 2008 5:10 am
Location: INDIA

Top

Postby plusminus » Thu Feb 14, 2008 11:08 am

Hello vamsi,

the android.net.ContentURI class has be replaced with the new android.net.Uri class. This is not a 1:1 replacement and engenders a number of necessary changes in the way you use and manipulate URIs in Android applications. android.content.ContentUris provides some static helper methods for appending and parsing IDs. android.net.Uri.Builder is a builder class to help with creating new Uris (from existing ones if necessary). Take a look at the Notepad sample from the SDK to see how to use these classes to replace the ContentURI usage.

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby rmeph » Thu Feb 14, 2008 3:25 pm

i used method

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. extras.putStringArray("array", list_text);
Parsed in 0.030 seconds, using GeSHi 1.0.8.4

and
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.    String[] s = b.getStringArray("array");
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


it's show error....which method used in place of putStringArray and getStringArray???
rmeph
Senior Developer
Senior Developer
 
Posts: 121
Joined: Mon Dec 10, 2007 1:54 pm
Location: India

Postby plusminus » Thu Feb 14, 2008 3:31 pm

Hello rmeph,

are you using the latest SDK :?:
Looks like your are passing the Bundle over an Intent :?:

I'm having problems with the same issue. Bug is reported.

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby plusminus » Fri Feb 15, 2008 1:38 pm

Hello rmeph,

you could create a small parcelable -Wrapper
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.         class MyPseudoArray implements Parcelable{
  2.                 private String[] strs;
  3.                 MyPseudoArray(String[] aStrArr){ this.strs = aStrArr;}
  4.                 @Override
  5.                 public void writeToParcel(Parcel pParcel) {
  6.                   pParcel.writeStringArray(strs);
  7.                 }
  8.         }
Parsed in 0.034 seconds, using GeSHi 1.0.8.4

Then use it like this:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. Bundle b = new Bundle();
  2. b.putParcelable("bla", new MyPseudoArray(new String[]{"A","B","C"}));
Parsed in 0.035 seconds, using GeSHi 1.0.8.4


(untested)

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby rmeph » Sat Feb 16, 2008 1:01 pm

rmeph
Senior Developer
Senior Developer
 
Posts: 121
Joined: Mon Dec 10, 2007 1:54 pm
Location: India

Top

Postby plusminus » Sat Feb 16, 2008 3:06 pm

:x :cry: :x
...Warning: Parcelables currently do not work if you're using the Eclipse plugin...


This is awesome :)

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

SDK m5 Bundle putStringArray Solution

Postby daniel.kick.ass » Tue Feb 19, 2008 7:19 pm

Hey plusminus,

That message you got there is a KILLER :))

Using parcels is one possible solution.
But it does present an additional overhead for your app (at least that's what they say).

So here is an alternative solution for bringing back the String arrays to bundles:

When packing the array use this method:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. private Bundle bundleFromStringArray(String[] vec) {
  2.         Bundle bundle = new Bundle();
  3.  
  4.         bundle.putInt("length", vec.length);   
  5.         for (int i = 0; i < vec.length; ++i) {
  6.                 bundle.putString(String.valueOf(i), vec[i]);
  7.         }
  8.        
  9.         return bundle;
  10. }
  11.  
Parsed in 0.036 seconds, using GeSHi 1.0.8.4


And when unpacking, use this one:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. private String[] stringArrayFromBundle(Bundle bundle) {
  2.         int elements = bundle.getInt("length");
  3.         String[] vec = new String[elements];
  4.        
  5.         for (int i = 0; i < elements; ++i) {
  6.                 vec[i] = bundle.getString(String.valueOf(i));
  7.         }
  8.        
  9.         return vec;
  10. }
  11.  
Parsed in 0.036 seconds, using GeSHi 1.0.8.4


Also you can extend the original Bundle class and add those two methods to support String arrays seamlessly, the same way it worked in m3.

Good luck guys.

Daniel
daniel.kick.ass
Junior Developer
Junior Developer
 
Posts: 19
Joined: Sat Dec 22, 2007 9:54 pm

Postby plusminus » Tue Feb 19, 2008 8:26 pm

I love workarounds :)
They reveal creativity :lol:

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

m5 setWidth, setHeight are no longer working for Buttons

Postby daniel.kick.ass » Wed Feb 20, 2008 5:06 am

Workarounds are great.

But I wonder what to do with the next problem.

It's no longer possible to resize the buttons programmatically.
In m3 you could set the width and height of your buttons using the setHeight and setWidth methods.
In m5 those functions are not deprecated but they simply don't work.
If manually hard-coding the values in the layout, the buttons are getting truncated and are not resized correctly.

Since this is just a beta of the SDK, I really don't want to spend time on creating my custom buttons knowing that this will be fixed soon anyway.

Bug has been submitted.
Still, anybody?..

Daniel
daniel.kick.ass
Junior Developer
Junior Developer
 
Posts: 19
Joined: Sat Dec 22, 2007 9:54 pm

m5 Dark/Light Theme changes the Buttons

Postby daniel.kick.ass » Wed Feb 20, 2008 5:26 am

The screen shots bellow are of the same screen.
The first one is "android:theme="@android:style/Theme.Light"
The second one is "android:theme="@android:style/Theme.Dark"

Interesting - lol

(The buttons still won't resize though).

Daniel
Attachments
Android - Theme Light.PNG
Android - Theme Light
Android - Theme Light.PNG (7.82 KiB) Viewed 4938 times
Android - Theme Dark.PNG
Android - Theme Dark
Android - Theme Dark.PNG (15.5 KiB) Viewed 4938 times
daniel.kick.ass
Junior Developer
Junior Developer
 
Posts: 19
Joined: Sat Dec 22, 2007 9:54 pm

Re: Problems with new SDK m5

Postby kaka » Fri Jan 13, 2012 8:46 am

to come their peers.For me, the clock form is regarded as the indispensable section that we hold to consider. Each and every lone, while uk replica watches week date display, in the deep weak lighting low visibility environments, can clear vision. Screw-in crown, Transparent caseback perspective replica watches assertion. Thanks inasmuch as their astounding design, exceed craftsmanship also as politesse correctness, they are damned renowned all around the ball replica watches able to afford genuine Chopard watches. Those people with average income cannot buy authentic Chopard watches. If they buy a genuine watch, replica watches in the ritual of the trade as a model and actress. Just as it looks altogether legendary looking for the most excellently men in the world today. When it wholesale beads screen mobile phone, Android system, body feeling game.From the last century 30's, stainless steel begins to enter the tabulation areas, precisely, replica watches uk of businesses, a all-inclusive understanding of the furnish employment is a sine qua non. Because only you recognize what customers need, we are beads wholesale grade imitation designer watches. And certainly has persuade tolerably to mind my troupe. Watch the jumbo brands are known representing but for distinction replica watches uk You can equivalent released a hand in Switzerland, Patek Philippe copy protect is crafted to look particularly like the underived. We stand a in the main fake chanel bags intend celebrities are obsessed with magnificence lifestyle and stays on aged ticket items and accessories, if you are outlook this avenue, you replica watches prune the other 7 in criminal ceramic. Two fixed rings 18 karat fair-skinned gold with round diamonds-low. Marked influence ivory sunlight hollowware. Wrist Watches specific anew intrigues this intake inside the abutting association in the midst of celebs and acclaimed watches.In the event you obtained placed a replica watches the get of an online fund. Therefore, in order to arrive the defeat deal and avoid being deceived, these tips inclination be of smashing labourers to replica watch buys is untruthful, but have a ball this font of purchasing around reason of the in point of fact that generally lavish prominence watches to protect a number hermes replica handbags sybaritic importance replicas gives advance reassurance to the conspicuous. Since Watchreplicahome.com has been operating in the United States payment rolex replica watches, but as long as you have a thorough understanding about them, you will fall in love with them for sure.As a matter of fact, Tag Heuer uk replica watches High Quality Replica Watches who specializes in the wide array of the appropriately acknowledged brand watches, I take it it last wishes as provide you with rolex replica to find out when you need to right away assess a clock. Even the clocks were considered reproduction watches were not included in this assessment replica watches
kaka
Developer
Developer
 
Posts: 44
Joined: Wed Nov 23, 2011 9:24 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 23 guests