Setting outer class variable from anonymous inner class
<p>Hey guys i am trying to export data from a third party app and then set the path of resulting exported file to my textview in main activity.But it isn't working.I searched all over and came to a conclusion that it has something to do with anonymous class,but i am still not able to fix it.Can anyone please guide me. </p>

<pre><code>public class MyActivity extends Activity
{

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    final Button btRecieve = (Button) findViewById(R.id.btRecieve);

    final Context context = this.getApplicationContext();

    final TextView tvFilePath = (TextView) findViewById(R.id.tvFilepath);
    final TextView tvFeedBack = (TextView) findViewById(R.id.tvFeedBack);

    final String pDateFrom = "2012-07-01";
    final String pDateTo = "2012-07-06";
    final String pExportType = "e5";
    final String pExportFormat = "csv";

    btRecieve.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            TimeRecordingExport exporter = new TimeRecordingExport(pDateFrom,pDateTo,pExportType,pExportFormat,tvFilePath);
            exporter.Export(context);
            String path = exporter.getFilePath();

            tvFilePath.setText(path);


        }
    });
}
}







public class TimeRecordingExport{
   //private variables
   String mDateFrom;
   String mDateTo;
   String mExportType;
   String mExportFormat;

   private String mFilepath;                     //path to the output file
   String feedback;

   TextView mTv;

   File file;

   Context mContext;

   final String KEY_RESULT_FILE = "com.dynamicg.timerecording.FILE";



//Constructor
   public TimeRecordingExport(String pDateFrom,String pDateTo,String pExportType,String pExportFormat,TextView tv){

     //Initialize private variables
     mDateFrom = pDateFrom;
     mDateTo = pDateTo;
     mExportFormat = pExportFormat;
     mExportType = pExportType;
     mTv = tv;

   }    //End constructor

   //Export function
   public void Export(Context pContext){
       mContext = pContext;
       //create a new intent with action export
       Intent intent = new Intent("com.dynamicg.timerecording.DATA_EXPORT");

       //Add extra values or you could say parameters to this intent.
       intent.putExtra("com.dynamicg.timerecording.DATE_FROM",mDateFrom);
       intent.putExtra("com.dynamicg.timerecording.DATE_TO",mDateTo);
       intent.putExtra("com.dynamicg.timerecording.EXPORT_TYPE",mExportType);
       intent.putExtra("com.dynamicg.timerecording.EXPORT_FORMAT",mExportFormat);

       //make a broadcast reciever
       BroadcastReceiver resultReceiver = new BroadcastReceiver() {
           @Override
           public void onReceive(Context context, Intent resultIntent) {

               Bundle bundle = this.getResultExtras(true);
               TimeRecordingExport.this.mFilepath = bundle.getString(KEY_RESULT_FILE);               //Path to the created file
               //mTv.setText(mFilepath[0]);
               file = new File(mFilepath);                                                           //New Created file

               feedback = "File=["+file+"], canRead=["+file.canRead()                                //Info about the created file
                       +"], sizeKB=["+(file.length()/1024)+"]";
               //Toast.makeText(mContext, feedback, Toast.LENGTH_LONG).show();

               Toast.makeText(context, feedback, Toast.LENGTH_LONG).show();
               System.out.println(feedback);
           }
       };
       mContext.sendOrderedBroadcast(intent, null, resultReceiver, null, Activity.RESULT_OK, null, null);
   } //End function export

   public String getFilePath(){

       return mFilepath;
   }

   public String getFileInfo(){
       return feedback;
   }

}   //End of class
</code></pre>
