Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1928030
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T06:55:48+00:00 2026-05-17T06:55:48+00:00

Hii I was coding for an application that shows the list of running process

  • 0

Hii

I was coding for an application that shows the list of running process and i was using TextView to display the running process in screen.
I was trying 2 different method for displaying the TextView.
In one method i was declearing the TextView in the code itself

TextView tv = new TextView(this);
this.setContentView(tv);

In the second method i was declearing the layout in the main.xml file

setContentView(R.layout.main);
TextView tv=(TextView) findViewById(R.id.RunApp);

For both the methods i am using the setMovementMethod for having the scroll movement for my TextView

tv.setMovementMethod(new ScrollingMovementMethod()); 

The program is running fine in the emulator.But if i am using the second method then the scrolling is not happening if i am running the application in my mobile. In the emulator its working fine. Why is it behaving differently in my Android 2.1 Samsung Galaxy S??
Why the scrolling not happening in the second method??. Scrolling is happening in the first method without any issues in my mobile.

This is my code..

public class listRunningApps extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //setContentView(R.layout.main);
    //TextView tv=(TextView) findViewById(R.id.RunApp);

    TextView tv = new TextView(this);
    this.setContentView(tv);

    tv.setMovementMethod(new ScrollingMovementMethod()); 

    ActivityManager actvityManager = (ActivityManager)
               this.getSystemService( ACTIVITY_SERVICE );
    List<RunningAppProcessInfo> procInfos = actvityManager.getRunningAppProcesses();

    for(int j=0; j < 2; j++) 
/*I have done iteration 2 times so that we have a long process list 
    sufficeint enough for scrolling*/
        {
        for(int i = 0; i < procInfos.size(); i++)
            {
                tv.setText(tv.getText().toString()+procInfos.get(i).processName+
                    " " + String.valueOf(procInfos.get(i).processName.length())+"\n");
            }

    tv.setText(tv.getText().toString()+"----------------------------"+"\n");
        }
     }
}

This is my main.xml

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

    <TextView
        android:id="@+id/jsttxt"  
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="Testing TextView Scrolling"/>

<TextView
    android:id="@+id/RunApp"
    android:layout_marginLeft="30px"
    android:layout_marginRight="30px"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/jsttxt"
    />

</RelativeLayout>

In the first method the scrolling is coming in my mobile without any issue..Can you guys help me why the scrolling is not happening in my mobile in the second method, where as its working properly in my emulator??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T06:55:49+00:00Added an answer on May 17, 2026 at 6:55 am

    why not you are putting your textview in scrollview in your xml layout. try that i think it work

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I am trying to deploy an application using webstart. I have a requirement
Hii , We generally see that the program execution begins in the main method
Hi i made some changes in windowservice coding side(some class files related to that),,means
Hii, I am using DataView control to bind a gridview. In dataview data is
Hii , I am developing an application where I ran across into this problem
Hii , I am relatively new to programming C++ . I do know that
Hi I'm trying to debug a stored procedure through SQL Analyzer and one of
Hi I'm trying to get some practice with Linked Lists. I Defined an Object
Hi I've searched some other posts, but most of them assumed that people knew
Hi I'm developing an invoicing application. So the general idea is to have two

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.