kkarthickk
kkarthickk

Reputation: 99

how to put our dynamic text as line by line?

{
 Recipedetails2 item_details = new Recipedetails2();
            item_details.setName("Godhumai veg adai");
            item_details.setIngredients("Samba godhumai rava  - 1/2 cup. Bread slices - 4. Curd ( thick ) - 1/2 cup  Carrot ( grated ) - 3 tsp Beetroot ( grated ) - 3 tsp Cabbage  ( grated ) - 2 tsp Green chilli - 1 Ginger - a small piece Garlic - 2 cloves Salt - as neededOil - as needed ");
            item_details.setMethods("1. Cut ginger,  green chilli, garlic finely. 2. Soak samba godhumai rava in curd for half an hour. 3. Dip bread slices in water, squeeze and add to the godhumai. 4. Add carrot, beetroot ,cabbage, ginger,  green chilli, garlic , salt, water and mix well to a batter. 5. Heat oil in a skillet. 6. Add ladle of batter, spread to a small thick circle and cook on both sides, dribbling oil.");
            item_details.setImageNumber(12);
            setUIScreen(item_details.getName(),item_details.getIngredients(),item_details.getMethods(),item_details.getImageNumber() );
        }

it will comes like paragraph but what i need is it has to come first point will comes and then next line next point like that manner i need,how we can do it in this code Method 1. Mix soya flour with buttermilk, salt to a batter. 2. Heat oil in a frying pan. 3. Add mustard, urad dal and when mustard splutters, add red chilli, asafoetida, soya mix and stir constantly on a medium flame. 4. When contents leave the sides of the pan, transfer to a greased plate, sprinkle moremilagai, curry leaves and cut into squares. i need like this but its coming as a paragraph my layout.xml file is

 <?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"

  android:orientation="vertical"

  >

    <TextView android:id="@+id/name"
        android:textSize="14sp" 
        android:textStyle="bold" 
        android:textColor="#32cd32" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"
        />

  <ImageView
    android:id="@+id/photo"
    android:layout_height="wrap_content"
    android:layout_width="fill_parent"
    android:layout_gravity="top"
    android:padding="20dp"
    android:scaleType="center"
  ></ImageView>



  <TextView
      android:text="Ingredients:"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:gravity="left" />

  <TextView android:id="@+id/itemIngredients"
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"
        android:scaleType="center" />

   <TextView
      android:text="Method:"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:gravity="left" />

  <TextView android:id="@+id/methods"
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"
        android:scaleType="center" />

</LinearLayout>

Upvotes: 0

Views: 73

Answers (1)

poitroae
poitroae

Reputation: 21377

Use the linebreak character \n to force newlines:

1. Mix soya flour with buttermilk, salt to a batter.\n
2. Heat oil in a frying pan.\n
3. Add mustard, urad dal and when mustard splutters, add red chilli, asafoetida, soya mix and stir constantly on a medium flame.\n
4. When contents leave the sides of the pan, transfer to a greased plate, sprinkle moremilagai, curry leaves and cut into squares.

So, wherever you want to start a newline you put a \n.

Upvotes: 1

Related Questions