jeudi 13 août 2015

Establish connection between app server and oracle database using java

I have been given a task to write a script in java, to connect oracle database from an app server. Scheduling tool will be used to schedule the job every 10 minutes.

If connection exists, the script will do nothing and just disconnect it. (and will be run again after 10 minutes). If cannot connect after 10 secs, the program will send an email notification.

The whole thing is to ensure connection can be established between the app server and the oracle db.

Really have no clue on this. Could you please advise what are the steps to do this and what Java APIs I'll need??

Many many thanks in advance!



via Chebli Mohamed

Full screen mode in java application

I would like to make an app that have a button that make the app full screen when clicked and then change to normal when the button is clicked second time. The JDK is 1.7 and I know it support application in full screen mode. I tried in many ways but not succeed. Please, is there someone who could help me?



via Chebli Mohamed

DateFormat return null java

I'm confused. I've tried, well I can not assign a null value to projects which have no date. What am i doing wrong?

 private static String projectDate = null;
    public static void main(String[] args) throws Exception {
        DateFormat formatter = new SimpleDateFormat("dd.MM.yyyy");
            List<Project> projects;
            if (projects == null || projects.size() == 0) {
            } else {
                for (Project project : projects) {
                    try {
                        projectDate = formatter.format(project.getLastAnalyzedDate().getTime());
                    }catch (Exception e) {
                        System.err.println("Last Analyzed failed");
                    }
                    outFile.println("<LastAnalyzed>" + projectDate + "</LastAnalyzed>");



via Chebli Mohamed

Simple upload to S3 from android

I've searched the web for ways to upload a simple file to s3 from android but couldn't find anything that work and I think it is because lack of concrete steps.

1.) http://ift.tt/1PaB2FW

That is the best guide I found but it does not tell what libraries to include. I downloaded the aws sdk for android and inside there were many jars. So intuitively, I included the aws-android-sdk-s3-2.2.5.jar however that is not complete. It does not have the class BasicAWSCredentials.

2.)I've looked at the more at the sample but it is not straightforward as #1 and I couldn't get the core upload functionality with credentials.

I appreciate your help



via Chebli Mohamed

Crosswalk project how to keep view alive

My app works with regular webview but it's very slow under Android 4.0 - 4.2 and just slow on 4.3 and 4.4.

I've already done lot of optimalizations in html/js/css, but still is too slow. So decided to take a look at Crosswalk project.

It's almost all great even with +20mb size for apk, except for one thing..

You cannot create XWalkView (equivalent of WebView) with Service context (like you can do with regular WebView) only Activity context is an option for Crosswalk view.

Why it's bad?

The website that I load into WebView/XWalkView uses WebSockets, it has to be always alive! But Android likes to kill apps, especially on older devices with Android 4.0-4.2.

Solution is to create WebView with Service context and keep reference to it in Service (Service is in foreground mode so hard to kill!).

Then if Activity will crash or will be garbage-collected, simply user taps to it, Activity recreates himself and gets reference to WebView (from Service class) to add it to his hierarchy again. :) (and in the meantime when activity didn't exist, webview was still working along with websocket connection)

All works, but with WebView and WebView is slow..

Why I am writing it? Need advice from you what to do or maybe solution how to force CrossWalk view to works with Service context.

Is it other way to keep XWalkView "always" alive?

Thanks!



via Chebli Mohamed

Java: PrintWriter object does not output the text on my file?

I'm trying to print out the usernames of a certain program into a file but PrintWriter is not printing anything on my file. I've tried everything mentioned on stackOverFlow none of them worked.

Users Class

private File usersListFile;
private PrintWriter usersListPrintWriter;
private Scanner usersListScanner;

Constructor:

Users(){
    try {
        this.usersListFile = new File("D:\\Dairy\\usersList.txt");
        if(usersListFile.exists()){
            this.usersListPrintWriter = new PrintWriter(new BufferedWriter(new FileWriter("D:\\Dairy\\usersList.txt", true)));
            this.usersListScanner = new Scanner("D:\\Dairy\\usersList.txt");
        }
        else
            System.err.println("File does not exist !");
    }
    catch(Exception e){
        System.err.println("Error: Users Class!");                   
    }
}

Method:

public void addToUsersList(String username){
        usersListPrintWriter.print(username);           
    }

Main Method:

public static void main(String[] args) {

    Users usersObject = new Users();
    usersObject.addToUsersList("USERNAME");

    }



via Chebli Mohamed

Android eclipse xml formatting issue

Hello i have a xml file which doesent seem to work, i am trying to reach it with a listpreference.

Here is the listpreference code:

<PreferenceCategory android:name="@string/yo_category">

<ListPreference
    android:title="YOYO"
    android:key="YOYOYO"
    android:summary="YODOBO"
    android:entries="@+arrays/yoyo"
    android:entryValues="@+arrays/yoyoValues"
></ListPreference>

</PreferenceCategory>  

And here is the xml file:

<string-array name="yoyo">
    <item>1 yoyo</item>
    <item>2 yoyos</item>
    <item>3 yoyos</item>
</string-array>
<string-array name="yoyoValues">
    <item>1</item>
    <item>2</item>
    <item>3</item>
</string-array>

PreferenceActivity class:

public class PreferenceHandler extends PreferenceActivity

@Override
protected void onCreate(Bundle savedInstanceState) 
{
    super.onCreate(savedInstanceState);

    getFragmentManager().beginTransaction().replace(android.R.id.content, new PrefFragment()).commit();
}

public static class PrefFragment extends PreferenceFragment
{
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);

        addPreferencesFromResource(R.xml.preferences);
}
}   

} And i cannot seem to find the issue here, i get no errors in eclipse but when i try to run it i cant see the items in the listpreference.

Thanks for any help!



via Chebli Mohamed

how to retrieve data from database in servlet

im beginners in java servlet... i working on curd operation... ...data not displaying please tell me where im wrong....

DAO.java

public void select(){

        try{
            Class.forName(jdbcDriver);
            Connection conn = DriverManager .getConnection(connectionString,username,password);
        PreparedStatement create = conn.prepareStatement("select * from student.users");

            ResultSet rs;
            rs = create.executeQuery();
            while(rs.next()){
                int id =rs.getInt("id");
                String name = rs.getString("fname");

            }
            }
            catch(Exception e){
                e.printStackTrace();
            }

    }

servlet.java

DAO user = new DAO();   /// i create object of DAO
user.select();  //calling select method

out.write("<td>");
                    out.write("<p>"+user.id+"</p>");    ///tried many from different way
            out.write("</td>");
            out.write("<td>"); 
                    out.write("<p>"+user.name+"</p>");    ///
            out.write("</td>"); 

i tried many from different way but no luck.... can you tell me where I'm wrong



via Chebli Mohamed

parse initialization is making the app crash

I am trying to use parse but parse told me to include the first code into the project to check if the data is transfered.... my app crashes...

I then followed a solution on stack overflow that explained how you have to initialize the parse in separate class and include it into manifest file... but after I followed it... my app still doesn't work... It crashes every single time..

Android manifest

   <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://ift.tt/nIICcg"
    package="com.example.parseexample"
    android:versionCode="1"
    android:versionName="1.0" >


    <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    <uses-sdk
        android:minSdkVersion="16"
        android:targetSdkVersion="21" />

    <application
        android:name=".Initializeparse"
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

MainActivity.java

package com.example.parseexample;


public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        ParseObject testObject = new ParseObject("TestObject");
        testObject.put("foo", "bar");
        testObject.saveInBackground();

    }


}

And this is my parseexample.java

    package com.example.parseexample;

    import com.parse.Parse;

    import android.app.Application;

    public class Initializeparse extends Application{

        @Override
        public void onCreate() {
            // TODO Auto-generated method stub
            super.onCreate();

            Parse.enableLocalDatastore(getApplicationContext());

            Parse.initialize(getApplicationContext(), "lUdLAC7d7HXQfdv1g7SO0T70jcc6vIMIHJRlYEvE", "ObFeYoJE3dqJmxMSfMkCQx37MvAqQfrNvnXHr38v");

        }



    }

Logcat

    08-14 05:07:48.569: D/HyLog(3996): I : /data/font/config/sfconfig.dat, No such file or directory (2)
08-14 05:07:48.569: D/HyLog(3996): I : /data/font/config/dfactpre.dat, No such file or directory (2)
08-14 05:07:48.569: D/HyLog(3996): I : /data/font/config/sfconfig.dat, No such file or directory (2)
08-14 05:07:48.579: I/dalvikvm(3996): Could not find method com.parse.Parse.initialize, referenced from method com.example.parseexample.Initializeparse.onCreate
08-14 05:07:48.579: W/dalvikvm(3996): VFY: unable to resolve static method 19: Lcom/parse/Parse;.initialize (Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)V
08-14 05:07:48.579: D/dalvikvm(3996): VFY: replacing opcode 0x71 at 0x0007
08-14 05:07:48.579: D/AndroidRuntime(3996): Shutting down VM
08-14 05:07:48.579: W/dalvikvm(3996): threadid=1: thread exiting with uncaught exception (group=0x41a00e48)
08-14 05:07:48.579: E/AndroidRuntime(3996): FATAL EXCEPTION: main
08-14 05:07:48.579: E/AndroidRuntime(3996): Process: com.example.parseexample, PID: 3996
08-14 05:07:48.579: E/AndroidRuntime(3996): java.lang.NoClassDefFoundError: com.parse.Parse
08-14 05:07:48.579: E/AndroidRuntime(3996):     at com.example.parseexample.Initializeparse.onCreate(Initializeparse.java:14)
08-14 05:07:48.579: E/AndroidRuntime(3996):     at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
08-14 05:07:48.579: E/AndroidRuntime(3996):     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4432)
08-14 05:07:48.579: E/AndroidRuntime(3996):     at android.app.ActivityThread.access$1500(ActivityThread.java:142)
08-14 05:07:48.579: E/AndroidRuntime(3996):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1263)
08-14 05:07:48.579: E/AndroidRuntime(3996):     at android.os.Handler.dispatchMessage(Handler.java:102)
08-14 05:07:48.579: E/AndroidRuntime(3996):     at android.os.Looper.loop(Looper.java:136)
08-14 05:07:48.579: E/AndroidRuntime(3996):     at android.app.ActivityThread.main(ActivityThread.java:5120)
08-14 05:07:48.579: E/AndroidRuntime(3996):     at java.lang.reflect.Method.invokeNative(Native Method)
08-14 05:07:48.579: E/AndroidRuntime(3996):     at java.lang.reflect.Method.invoke(Method.java:515)
08-14 05:07:48.579: E/AndroidRuntime(3996):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
08-14 05:07:48.579: E/AndroidRuntime(3996):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:608)
08-14 05:07:48.579: E/AndroidRuntime(3996):     at dalvik.system.NativeStart.main(Native Method)



via Chebli Mohamed

Parse Json into a Map in Java

I have a json whose structure can vary in terms of number of nested levels. Like some of the key might have a json object, some of the key might have json object inside a json object. So any key can have a json object (of different depth) or a String as its value. For example,

{
 k1: v1,
 k2: {
      k21: {
           k211: v211,
           k212: v212
           },
      k22: {
           k221: v221,
           k222: v222
           }
     },
 k3: {
      k31: v31
     }
}

Note that k1, k2, k3 have value different levels of json objects (depth of json objects vary) as their values.

I need to parse the above json into a map of key and values like below,

<k1, v1>,
<k211, v211>,
<k212, v212>,
<k221, v221>,
<k222, v222>,
<k31, v31>

How can we parse them like that in java?



via Chebli Mohamed

Java if statement issue? [duplicate]

This question already has an answer here:

I am working on a code that takes what you input into a window's text box, and answers you accordingly. Currently I am trying to say that if the user enters the word "yes", two windows will display, one saying "k, lets talk", and one saying "you typed in yes". Right now only the second window is opening, and the first two if statements aren't even executing. How can I make this work?

class hear implements ActionListener{

    public void actionPerformed(ActionEvent event){

        String string = "";
        if (event.getActionCommand() == "yes"  || event.getActionCommand() =="Yes" || event.getActionCommand() =="YES")
             JOptionPane.showMessageDialog(null, "k, lets talk");
         if (event.getActionCommand() == "no"  || event.getActionCommand() =="NO" || event.getActionCommand() == "NO")   
             JOptionPane.showMessageDialog(null, "k bye!");
        if(event.getSource()==textfield)
            string = String.format("You typed in %s", event.getActionCommand());


         JOptionPane.showMessageDialog(null, string); //Open a new window that displays String string, which has changed based on which field you hit enter on.



via Chebli Mohamed

Hibernate Session Issue

I am facing an hibernate session issue. In the DAO class am using Hibernate template to get the data which returns 2 rows. These 2 entities have same foreign key. The issue is first record is retreived successfully where as second record throw "collection is not associated with any session" . I tried adding @Transactional but that didnt help. pls suggest

(List<EntityName>) hibernateTemplate.findByCriteria(detachedCriteria,searchCriteria.getFirstResult(),searchCriteria.getMaxResults());

Collection

    <set name="entites" lazy="false" cascade="all" inverse="true">
     <key column="Key" not-null="true" property-ref="xxx"/>
     <one-to-many class="EntityClass"/>
    </set>



via Chebli Mohamed

JSP servlet include tuncated

I am trying to include the response from a servlet in a jsp page using:

<li><jsp:include page="/icr/TasksServlet.html"/></li>

The servlet gives back one word:

try (PrintWriter out = response.getWriter()) {
        out.println("OOps");
        out.flush();
        out.close();
    }

And the result is that my page is truncated directly after the "OOps"

    <ul class="navList">
    <li>ICR Open Tasks</li>
    <li>
        <ul>
    <li>OOps

The tomcat throws this error:

org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet 
[validateUser] in context with path [/CAS] threw exception
[java.lang.IllegalStateException: Exception occurred when flushing data]
with root cause
java.io.IOException: Stream closed

I have tried to add and remove the out.flush(); and out.close(); as well as added flush="true" to the jsp:include tag.

I running tomcat 8.0.24; Netbeans with spring MVC.



via Chebli Mohamed

I am doing a project in Java with Android jni C++. I have a function in C++ with the following parameters:

C++ function: void rectify (vector <Point2f> & corners, Mat & img) {...}

In JAVA, call would be:

Mat image = Highgui.imread("img.png");
List <MatOfPoint> cornners =  new ArrayList<MatOfPoint>();;
Point b = new Point (real_x2, real_y2);
MatOfPoint ma = new MatOfPoint (b);
cornners.add(ma);
rectfy(image.getNativeObjAddr(), cornners)

public native void rectfy(long mat, "??" matofpoint);

With that, I wonder how will the function C++ jni:

JNIEXPORT void JNICALL Java_ImageProcessingActivity_rectfy (JNIEnv * jobject, ?? cornners, inputMatAddress jlong)



via Chebli Mohamed

null pointer exception when sending ISO8583 request

I am trying to send an ISO8583 request to a terminal using the following code:

try {
        XMLParser packager = new XMLParser(this.xmlFile);


        final ISOMsg isoMsg = new ISOMsg();
        isoMsg.setPackager(packager);
        isoMsg.setMTI("0800");
        isoMsg.set(3, "xxxxxx");
        isoMsg.set(7, "xxxxxxxxxx");    //MMDDhhmmss
        isoMsg.set(11, "xxxxxx");
        isoMsg.set(12, "084500");       //Time of the message HHmmss
        isoMsg.set(13, "0621");         //Date MMDD
        isoMsg.set(41, "xxxxxxxx");
        isoMsg.set(62,"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
        isoMsg.set(63,"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
        BaseChannel channel = new BaseChannel() {};
        channel.setLogger(logger, "server-request-channel");
        channel.setHeader(isoMsg.pack());
        channel.setHost("xx.xx.xx.xx", xxxxx);
        ISOMUX isoMux = new ISOMUX(channel) {
            @Override
            protected String getKey(ISOMsg m) throws ISOException {
                return super.getKey(m);
            }
        };

        isoMux.setLogger(logger, "server-request-mux");
        new Thread(isoMux).start();
        ISORequest req = new ISORequest(isoMsg);
        isoMux.queue(req);
        req.setLogger(logger, "server-request-logger");
        ISOMsg response = req.getResponse(50 * 1000);

        if (response != null) {
                System.out.println("Req ["+ new String(isoMsg.pack()) + "]");
                System.out.println("Res ["+ new String(response.pack()) + "]");
            }else{
                System.out.println("Timeout");
            }
        }catch (Exception e) {
            e.printStackTrace();
        }
    }

After executing the code, I get the following error:

<log realm="server-request-mux" at="Fri Aug 14 00:26:43 WAT 2015.995">
    <muxreceiver>
        <exception name="null">
            java.lang.NullPointerException
            at org.jpos.iso.BaseChannel.createISOMsg(BaseChannel.java:561)
            at org.jpos.iso.BaseChannel.createMsg(BaseChannel.java:558)
            at org.jpos.iso.BaseChannel.receive(BaseChannel.java:585)
            at org.jpos.iso.ISOMUX$Receiver.run(ISOMUX.java:263)
            at java.lang.Thread.run(Thread.java:856)
        </exception>
    </muxreceiver>
</log>

I added break point so as to find out the line causing the exception and discovered that the exception occurs whenever it encounters the statement:

ISORequest req = new ISORequest(isoMsg);

I am relatively new to ISO8583 jpos financial programming and I want to building an app on android platform.

How do I get over this exception?



via Chebli Mohamed

Timestamp based sorting for a nested Map

I have a nested Map being returned by the Guava Library's Table structure that is templated as follows:

Map<ComplexID1, Map<ComplexID2, MyObject>>

where ComplexID1 is my row key, ComplexID2 is my column key and MyObject holds my metadata. One of the attributes of my metadata is a JODA timestamp.

I need to sort this whole structure chronologically (or reverse chronologically) for display, newest objects created at the top, going backwards.

I was unable to find any information to sort this data structure. Could someone please provide some pointers?

Further, I tried to have the MyObject class extend Comparable and override CompareTo on the JODA datetime object because I was trying to use Collections.Sort(). Unfortunately, that approach does not seem to work for me.



via Chebli Mohamed

which is the best for GUI C++ Qt or C# or JAVA 2015

hi i want to ask you a question i had learn c++ and something about the framework Qt but the problem that now day the Qt is not used in the world of apps smartphone like C# or JAVA !! so do u leave c++ and Qt and start with C# or JAVA ?? please i need your Advice Thank you



via Chebli Mohamed

Counting all elements in map of string to list

Is there a better way to calculate size of all lists in map? So firstList.size() + secondList().size? I have done this, but creating a list just for counting doesn't feel right approach ..

public static void main(String[] args) {
    List<String> firstList = new ArrayList<>();
    firstList.add("first");
    List<String> secondList = new ArrayList<>();
    secondList.add("second");

    Map<String, List<String>> myMap = new HashMap<>();
    myMap.put("one", firstList);
    myMap.put("two", secondList);

    int size = myMap.entrySet().stream().map(entry -> entry.getValue()).flatMap(list -> list.stream()).collect(Collectors.toList()).size();
    System.out.println("Size of all elements in map is:" + size);

}



via Chebli Mohamed

Internal working of Comparator [on hold]

Can you please explain how sorting is performed here using Comparator? Can you make a simple step by step explanation for Collections.sort(al, Student.StuNameComparator);?

Student class:

public class Student {
    private String name;
    private int rollno;

    public Student(int rollno, String name) {
        this.rollno = rollno;
        this.name = name;
    }

    public static Comparator<Student> StuNameComparator = new Comparator<Student>() {
        public int compare(Student s1, Student s2) {
            return s1.name.compareTo(s2.name);
        }
    };

    public String toString() {
        return "Roll No: " + rollno + " Name: " + name;
    }
}

main method:

public static void main(String args[]) {
   ArrayList<Student> al = new ArrayList<Student>();
   al.add(new Student(983, "AAA" ));
   al.add(new Student(981, "KKK" ));
   al.add(new Student(999, "BBB"));

   System.out.println("Student Name Sorting:");
   Collections.sort(al, Student.StuNameComparator);

   for(Student str: al) {
        System.out.println(str);
   }
}



via Chebli Mohamed

Add an element from a listView to another listView

I want to create an add to favorites action bar button on the news and to add it to a new list adaptor in the favorites tab, can you help me please implementing the button an how to create the new list?

here is my code: (displaying the clicked news)

    public class ListItemClicked extends ActionBarActivity {

    static Bundle extras;

    SectionsPagerAdapter mSectionsPagerAdapter;
    static ImageLoader imageLoader;
    static DisplayImageOptions options;




    ViewPager mViewPager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.list_item_clicked);


        mSectionsPagerAdapter = new  SectionsPagerAdapter(getSupportFragmentManager());

        extras = getIntent().getExtras();

        mViewPager = (ViewPager) findViewById(R.id.pager);
        mViewPager.setAdapter(mSectionsPagerAdapter);

        //Setup the ImageLoader, we'll use this to display our images
        ImageLoaderConfiguration config = new  ImageLoaderConfiguration.Builder(this).build();
        imageLoader = ImageLoader.getInstance();
        imageLoader.init(config);

        //Setup options for ImageLoader so it will handle caching for us.
        options = new DisplayImageOptions.Builder()
                .cacheInMemory()
                .cacheOnDisc()
                .build();

    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_main_activity2, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        int id = item.getItemId();

        return id == R.id.action_settings || super.onOptionsItemSelected(item);

    }



    public class SectionsPagerAdapter extends FragmentPagerAdapter {

        public SectionsPagerAdapter(FragmentManager fm) {
            super(fm);
        }

        @Override
        public Fragment getItem(int position) {
            return PlaceholderFragment.newInstance(position + 1);
        }

        @Override
        public int getCount() {
            return 2;
        }

        @Override
        public CharSequence getPageTitle(int position) {
            Locale l = Locale.getDefault();
            switch (position) {
                case 0:
                    return getString(R.string.title_section4).toUpperCase(l);
                case 1:
                    return getString(R.string.title_section5).toUpperCase(l);
            }
            return null;
        }
    }


    public static class PlaceholderFragment extends Fragment {


        private static final String ARG_SECTION_NUMBER = "section_number";


        public static PlaceholderFragment newInstance(int sectionNumber) {
            PlaceholderFragment fragment = new PlaceholderFragment();
            Bundle args = new Bundle();
            args.putInt(ARG_SECTION_NUMBER, sectionNumber);
            fragment.setArguments(args);
            return fragment;
        }

        public PlaceholderFragment() {
        }

        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                 Bundle savedInstanceState)
        {

            View rootView = inflater.inflate(R.layout.fragment_list_item_clicked, container, false);


            TextView pDate = (TextView) rootView.findViewById(R.id.textView);
            pDate.setText( extras.getString("pdate") );


            TextView ptitle = (TextView) rootView.findViewById(R.id.section_label);
            ptitle.setText(extras.getString("pname"));


            TextView pnText = (TextView) rootView.findViewById(R.id.textView2);
            pnText.setText( extras.getString("pText"));




            //Setup a listener we can use to swtich from the loading indicator to the Image once it's ready
            ImageLoadingListener listener = new ImageLoadingListener(){



                @Override
                public void onLoadingStarted(String arg0, View arg1) {
                    // TODO Auto-generated method stub

                }

                @Override
                public void onLoadingCancelled(String arg0, View arg1) {
                    // TODO Auto-generated method stub

                }

                @Override
                public void onLoadingComplete(String arg0, View arg1, Bitmap arg2) {
                    // i/ndicator.setVisibility(View.INVISIBLE);
                    // iconImg.setVisibility(View.VISIBLE);
                }
                @Override
                public void onLoadingFailed(String arg0, View arg1, FailReason arg2) {
                    // TODO Auto-generated method stub

                }

            };

            //Load the image and use our options so caching is handled.
            final ImageView iconImg = (ImageView) rootView.findViewById(R.id.imageView);
            imageLoader.displayImage( extras.getString("pImage"), iconImg, options, listener);



            return rootView;
        }
    }

}

the first list adaptor with news news from list adaptor clicked the favorites tab



via Chebli Mohamed