0

I am not sure just trying to find out is there any way we can send data from main project to library project ? Below code giving me classnotfound exception here LockScreenActivity is my library project activity. I am calling this code from the main project.

 Intent myIntent = null;
    try {
        myIntent = new Intent(this,Class.forName("nseit.com.lockscreenusingservice.LockScreenActivity"));
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }
    myIntent.putExtra("exam_id",exam_id);

    myIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(myIntent );
Pushpendra
  • 2,791
  • 4
  • 26
  • 49
Vishvendu Palawat
  • 566
  • 10
  • 29
  • 1
    have you added a deependancy to your lib project? if yes, then you don't have to find class by name, just import it and use same way as if it was in same project. It you didn't add, then it is not strange that it doesn't find the class. – Vladyslav Matviienko Jun 07 '17 at 06:59
  • I am getting null on the library activity when I am passing data through bundle from the main project.class cast exception is gone but data is null on the library side. Intent intent = getIntent(); try{ if(intent != null){ String Examid = intent.getStringExtra("exam_id"); } }catch(Exception e){ } Examid is null on the library project..@VladMatvienko – Vishvendu Palawat Jun 07 '17 at 07:42
  • is `exam_id` a String? – Vladyslav Matviienko Jun 07 '17 at 08:22
  • Yes exam_is is a string – Vishvendu Palawat Jun 07 '17 at 08:38
  • pls add the error messages from the logcat. – 4knahs Jun 09 '17 at 11:00

0 Answers0