Tuesday, January 1, 2013

Re: [android-developers] Re: help me urgent

sree wrote:
After takeing two one dimensional arrays, i [sic] prepared one two dimensional array.like this way

String [ ][ ] taskoutput=new String[prioritynamearray.length][taskvaluesarray.length];

Please follow the Java naming conventions. It will benefit you, too.

Also, "array" (or variant) in a variable name is generally not useful. Variables usually should not be 
named for their type.
 
then Loop is rotating like this way,

for (int s = 0; s <prioritynamearray.length; s++) {

Watch your crazy indentation, please.

DO NOT USE TAB CHARACTERS TO INDENT USENET POSTS!

for (int t = 0; t <taskvaluesarray.length; t++) {
taskoutput[s][t]=here how can i add above two values into 2d arrays.

What do you want here? You have not told us. 

You are, in effect, defining a transformation from the cross between the value sets represented by 
(I'll rename your variables) 'priorities' and 'tasks'. Let me draw it:

  \  priorities
         |  [0]  |  [1]  |  [2]  |  ...
tasks |---  ---|---  ---|---  ---|  ...
  [0]   |   ?    |   ?   |   ?   |  ...
 ---  ---|---  ---|---  ---|---  ---|  ...
  [1]   |   ?    |   ?   |   ?   |  ...
 ---  ---|---  ---|---  ---|---  ---|  ...
  [2]   |   ?    |   ?   |   ?   |  ...
 ---  ---|---  ---|---  ---|---  ---|  ...
  [3]   |   ?    |   ?   |   ?   |  ...
 ---  ---|---  ---|---  ---|---  ---|  ...

You will need 'priorities.length' times 'tasks.length' values to fill in those question-marked
matrix entries.

What goes there?

Please tell us.

  Foo results = new Foo [tasks.length] [priorities.length];
  for (int tx = 0; tx < tasks.length; ++tx)
  {
    for (int px = 0; ix < priorities.length; ++px)
    {
      Task task = tasks[tx];
      Priority priority = priorities[px];
      results [px][tx] = whatDoYouWantHerePleaseTellUs(task, priority);
    }
  }

You need to tell us what you want in that box.

Obviously it's a value that depends on the two indexing values. You likely would want to factor 
that out as a method on the two arguments as I showed here.

So what do you want in that box?

-- 
Lew

      

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment